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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.