๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Power BI/Power Query M

[Power BI] Power Query M ํ•จ์ˆ˜ - let, in

๋ฐ˜์‘ํ˜•
let 
    a = [์—ด1],
    list1 = Table.SelectRows([Table], each [begin] <= a)[index],
    list2 = Table.SelectRows([Table], each [end] >= a)[index]
in 
    List.Intersect({list1, list2})โ€‹

let statement ์—์„œ ๋ณ€์ˆ˜ ์„ ์–ธ, ํ•จ์ˆ˜ ์„ ์–ธ, ํ˜ธ์ถœ ๊ฐ€๋Šฅ

a ๋ณ€์ˆ˜์— [์—ด1] ๋Œ€์ž…

[Table]์—์„œ [begin]์ด a ๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ๊ฐ’๋“ค์˜ index๋ฅผ list1์— ๋Œ€์ž…

[Table]์—์„œ [end]์ด a ๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™์€ ๊ฐ’๋“ค์˜ index๋ฅผ list2์— ๋Œ€์ž…

์ตœ์ข… = list1, list2์ค‘ ์ค‘๋ณต ๊ฐ’

 

let  
    Add = (x, y) => x + y,  
    AddResults =   
        [  
            OnePlusOne = Add(1, 1),     // equals 2  
            OnePlusTwo = Add(1, 2)      // equals 3  
    ]  
in  
    AddResults  

Add : ํ•จ์ˆ˜๋ช…

parameters : x, y / parameters type : any / return : x + y

 

์žฌ๊ท€ํ•จ์ˆ˜ @ ์ด์šฉ

let   
    fact = (num) => if num = 0 then 1 else num * @fact (num-1)   
in   
    fact(5) // equals 120  

 

https://docs.microsoft.com/en-us/powerquery-m/understanding-power-query-m-functions

 

Understanding Power Query M functions - PowerQuery M

Understanding Power Query M functions In this article --> In the Power Query M formula language, a function is a mapping from a set of input values to a single output value. A function is written by first naming the function parameters, and then providing

docs.microsoft.com

 

๋ฐ˜์‘ํ˜•