Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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?
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.