Introduction to custom functions in Power Query (part 1)

  Рет қаралды 1,462

Exceed Learning

Exceed Learning

3 жыл бұрын

In this video, we will introduce you to custom M functions in Power Query.
In the Power Query M formula language, a function is a mapping from a set of input values to a single output value.
This definition is described in more detail in the video by using an everyday example that is easy to follow and understand.
Check out our new Power Query fundamentals course!
exceed.hr/en/academy/powerque...
#powerquery #powerbi #etltools #data #dataanalysis

Пікірлер: 10
@kumaraswamymandala3612
@kumaraswamymandala3612 Жыл бұрын
Very good explanation to understand function in power query.
@SaniGarba
@SaniGarba 3 жыл бұрын
Thanks.
@chilaw2004
@chilaw2004 Жыл бұрын
The last thing I expected when I clicked on this video was a story about an ice cream man! But it’s a memorable image and helped me understand the logic of functions in M code. Thanks again!
@kebincui
@kebincui Жыл бұрын
Vivid explation with easy understood simile😍
@chakrabmonoj
@chakrabmonoj Жыл бұрын
Hey Sensei...I really like your videos a lot. They are extremely resourceful and far better than many others out there on YT. I am struggling with one of your videos earlier, in which you used a nested function which returns another function and used it within a query step to lookup values from another table. Your code went something like this : RateAnotherWay = Table.AddColumn(#"Added Custom1", "Rate_V1", (TargetTable)=> Table.SelectRows(RateMaster, (SourceTable)=> Text.Contains(TargetTable[Ingredient],SourceTable[Ingredient]))) This works within the query. But when I tried to re-write the code as a stand alone function query as below : (TargetTable as table)=> let RateAnotherWay = Table.SelectRows(RateMaster, each Text.Contains(TargetTable[Ingredient],[Ingredient])) in RateAnotherWay It returns an error : value as list Vs. value as text. Is there a reason it is not working the way I wrote it? Can you help me please with the edit?
@damianocausale
@damianocausale 3 жыл бұрын
Very useful explanation. Using sample of ice cream man helps to understand the logical way to build a function in Power Query. Great job!
@ExceedLearning
@ExceedLearning 3 жыл бұрын
Thank you Damiano!
@malchicken
@malchicken 3 жыл бұрын
Excellent general explanation, thank you. The video makes me think it would be interesting to see a video on ‘a custom function made to execute other custom functions’. It’s like getting to advanced layered programming. I took the “Sugar.Add” type examples as like custom functions, within this new custom function your creating which makes me think 🤔 it would be neat to make a ‘super custom function’ made of a bunch of other custom functions, which are made of power queries native functions. 👍
@ExceedLearning
@ExceedLearning 3 жыл бұрын
Hi Hendrick! Yes, in Power Query it is possible to nest custom function inside the other functions. A theoretical example is given below: (InputNumber as number)=> let Source = InputNumber+10, FXDivide = (InputNumber2 as number)=> let StartingNumber = InputNumber2, Divide = StartingNumber / 2 in Divide, DivideFirstStep = FXDivide(Source) in DivideFirstStep In this function, you can see that we have a nested function called FXDivide that is local to this function only so it cannot be invoked from other queries (this is not necessary, FXDivide could also be defined as another query of the function type). For example, if number 10 enters this function, it will first become 20 (the Source step), and after the function definition, it will be divided by 2 with the third step (DIvideFirstStep). In this way, you could make a custom function in which other functions are executed. Thank you for your input! We might add this topic as one of our next videos :)
@malchicken
@malchicken 3 жыл бұрын
@@ExceedLearning Wonderful, very neat! ^^ thank you for the detailed explanation. So with the food prep example each of those actions could be defined within the query, or be calling other ‘function queries’. I’ll have to try this for a query I used recently with 5 steps I repeated across a few columns. Now I’ll just make a function of those 5 steps, and apply that function to each column. Much simpler. Thank you ^^. Any videos on the best way to share code with other colleagues so it’s easy for them to use the same functions would be much appreciated as well :)
Creating custom M functions in Power Query (part 2)
12:51
Exceed Learning
Рет қаралды 2 М.
Nested functions and Table.Buffer()
19:54
Exceed Learning
Рет қаралды 18 М.
Happy 4th of July 😂
00:12
Pink Shirt Girl
Рет қаралды 32 МЛН
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 36 МЛН
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 47 МЛН
Custom Comparer Function for Table.Group in Power Query M
23:17
BI Gorilla
Рет қаралды 4,5 М.
APQ01: Advanced Power Query  Video #1 - Custom Functions
21:45
AAA Excel’s Power
Рет қаралды 38 М.
Write Your First CUSTOM M FUNCTION in Power BI
11:34
How to Power BI
Рет қаралды 28 М.
Improve the Look and Feel of Tables and Matrix in Power BI
14:00
5 WAYS to use BOOKMARKS in Power BI
9:54
How to Power BI
Рет қаралды 105 М.
Write Nested Let in Power Query
9:32
Goodly
Рет қаралды 13 М.
Power Query - Data from many folders with Single Query
12:01
BA Sensei
Рет қаралды 12 М.
Happy 4th of July 😂
00:12
Pink Shirt Girl
Рет қаралды 32 МЛН