Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello, Everyone!
I need a dificult solution i hav benn working for two days without solution.
I hav a simple table, with the month and a number.
I must create a Running total of the number column and substract from the running total of this result column.
Is a crazy math but need to be done. In DAX is very easy to do this, but i really need this in Power Query.
I will atach a image of the excel for make more easy to understand of my issue.
The formula in formula bar translated to english will be:
= ABS ( SUM ( $C$3:C11 ) ; 0 ) - ABS ( SUM ($D$3:D10 ) ; 0 )
in January the formula need to be just the ABS of January (if not it will be a circular expression)
What I tried to do until now;
Create a function to make the running total of the column I need, called fnRunningTotal to run in the two columns
Make a column with the if statment:
if month = "Jan" then Number.Abs([Base Calc]) else fnRunningTotal ( [BASE CALC] ) - fnRunningTotal ( [CONTR],{index}-1)
But without sucess of create the function.
Thanks for all the help!
See if this works for you:
https://www.youtube.com/watch?v=EP4L1FVcSUg
I believe you will need to create 2 different running total columns and then a third calc column for the difference. Have you also tried using Dax on the calc column vs M?
I'm just get the running of one column with the query above:
List.Sum(List.Range(#"LastStep"[BASE CALC], ( if [Mês]="Jan" then [Index] else if [Mês]="Fev" then [Index]-1 else if [Mês]="Mar" then [Index]-2 else if [Mês]="Abr" then [Index]-3 else if [Mês]="Mai" then [Index]-4 else if [Mês]="Jun" then [Index]-5 else if [Mês]="Jul" then [Index]-6 else if [Mês]="Ago" then [Index]-7 else if [Mês]="Set" then [Index]-8 else if [Mês]="Out" then [Index]-9 else if [Mês]="Nov" then [Index]-10 else if [Mês]="Dez" then [Index]-11 else 0), (if [Mês]="Jan" then 1 else if [Mês]="Fev" then 2 else if [Mês]="Mar" then 3 else if [Mês]="Abr" then 4 else if [Mês]="Mai" then 5 else if [Mês]="Jun" then 6 else if [Mês]="Jul" then 7 else if [Mês]="Ago" then 8 else if [Mês]="Set" then 9 else if [Mês]="Out" then 10 else if [Mês]="Nov" then 11 else if [Mês]="Dez" then 12 else 0 )))
Just need to get the second part.
Thanks again
Despite the solution that I presented in the last post, it is not even efficient, taking more than 1 hour to run. Would anyone else have a solution?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |