Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Summing output of running total with itself

Hello guys,

 

I have a very complex case that I am presenting here. Need DAX for the following.

 

As we stand in the month of September, the formulas are given for the September and so on in row 'FC VOL CAL'

These formulas will then be carried forward in the same way when we stand in the month of October.

 

It is a lot to do with running total. I can get the total for SOH and IMS, but the running total of the running total of the subtraction (see, already confusing) is not quite happening, especially with the ZERO replacement as well.

 

  EFGHIJK
  sepoctnovdecjanfebmar
4soh02258608927235001404
 rt soh0225862258631513338633386335267
6ims2684358735424093445237114033
 rt ims26846271981313906183582206926102
 fc vol00163150129200
10fc vol cal=IF((E4-E6)<0,0,E4-E6)=IF((E4-E6-E10)<0,0,E4-E6-E10)=IF(((E4+F4)-(E6+F6)-(E10+F10))<0,0,(E4+F4)-(E6+F6)-(E10+F10))=IF(((E4+F4+G4)-(E6+F6+G6)-(E10+F10+G10))<0,0,(E4+F4+G4)-(E6+F6+G6)-(E10+F10+G10))=IF(((E4+F4+G4+H4)-(E10+F10+G10+H10))-(E6+F6+G6+H6)<0,0,(E4+F4+G4+H4)-(E10+F10+G10+H10)-(E6+F6+G6+H6))00

 

 

 

1 REPLY 1
lbendlin
Super User
Super User

Instead of all these IF functions use MAX

 

so 

=IF((E4-E6)<0,0,E4-E6)

becomes 

=MAX(E4-E6,0)

 

etc.

 

In order for your data to become usable you will want to unpivot it first. Like so (for example)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZU+7DsIwDPwVlJkhdt4fwcJadSglFSBKUFvK72ObFqliyJ3t3PlRVepY3mqvDrkZX0OmaMxPwtJOhI8yE55zS3hrHoRdPhH2zaDqfaUs68uFUNNDdNEvcUwYuGScXipgtRWTo2SYdv++lQ04MMwm+g079EFasOraj+zx0cpXDEIWiaxOrLfWcWYCgBSNEXP4zt/4PQbWpCiDwSTNIyBSX1lM+yRi0Cg9uNq1u7nclxvkQk+brzEm/H3V9Qc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#" " = _t, #" .1" = _t, E = _t, F = _t, G = _t, H = _t, I = _t, J = _t, K = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {"Row", "Measure"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.