This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi Guys,
need some help with Power Query M Code as im new to it.
I want to make some columns and it has to be in Power Query as i need to ammend this into another table.
I want to make columns using these DAX formulas but alter them to M Code:
REV - VAL =
VAR
REV = CALCULATE(SUM('Table1'[Value]), FILTER('Table1', 'Table1'[Name] = "Rev"))
VAR
VAL = CALCULATE(SUM('Table1'[Value]), FILTER('Table1', 'Table1'[Name] = "Val"))
Return
+REV - Direct
Value1 = [REV - VAL] / CALCULATE(SUM('Table1'[Value]), FILTER('Table1', 'Table1'[Name] = "Name1"))
Value2 = [Value1] - CALCULATE(SUM('Table1'[Value]), FILTER('Table1', 'Table1'[Name] = "Name2"))
How can i replicate these measures into M Code?
Solved! Go to Solution.
Hi @paulfink ,'
I have built a simply data sample with your DAX code:
Please use the below codes(List.Sum function) to create Custom columns:
Rev=let _item = [Name] in List.Sum(Table.SelectRows(#"Changed Type", each [Name] = "Rev")[Value])Val= let _item = [Name] in List.Sum(Table.SelectRows(#"Rev", each [Name] = "Val")[Value])
...
After doing all sum for each Name, the table will be like this:
Then:
The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @paulfink ,'
I have built a simply data sample with your DAX code:
Please use the below codes(List.Sum function) to create Custom columns:
Rev=let _item = [Name] in List.Sum(Table.SelectRows(#"Changed Type", each [Name] = "Rev")[Value])Val= let _item = [Name] in List.Sum(Table.SelectRows(#"Rev", each [Name] = "Val")[Value])
...
After doing all sum for each Name, the table will be like this:
Then:
The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Wow thats amazing, is it possible to have blank cells that dont relate to the filtered names? just so i can merge into one column
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 32 | |
| 26 | |
| 23 | |
| 22 | |
| 15 |
| User | Count |
|---|---|
| 63 | |
| 45 | |
| 28 | |
| 24 | |
| 22 |