M Query - auto-mate/CheatSheetWiki GitHub Wiki

Use Excel Value in named cell

To get the "part" val from named cell "part"

part = Excel.CurrentWorkbook(){[Name="part"]}[Content]{0}  
// value used as part[Column1]

Concatanate

Text.Combine({"A","B"})  

Text To Number

Text.From(month[Column1]) 

format

let  
   b=a,  
   c=amended(b)  

 in 
   b  

concat

To make 'OK'...

x = "'" & "OK" & "'",  

sample

let

    PSource = Excel.CurrentWorkbook(){[Name="SomeTableName"]}[Content],
    Param= Text.From(PSource[SomeFieldName]{0}), // Record 0 Counting from 0

    Param2 =   
              if Param="OptionalValueInParam01"  then "'SomeValueForParam2'" // Notes as required
        else  if Param="OptionalValueInParam02"  then "'SomeValueForParam2'" // Notes as required
        else  if Param="OptionalValueInParam03"  then "'SomeValueForParam2'" // Notes as required
        else  if Param="OptionalValueInParam04"  then "'SomeValueForParam2'" // Notes as required
        else  if Param="OptionalValueInParam05"  then "'SomeValueForParam2'" // Notes as required
        else "'','',''",

   Source = Sql.Database("SERVER", "DATABASE NAME", [Query="SELECT ..... FROM ....	WHERE .... IN  (" &Param2& ")"]),
in
   Source