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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Running Total from a given Measure

Need help in calculating Running/Cummulative total

 

I have a given measure that basically counts units grouped by date

 

Measure1:=CALCULATE(DISTINCTCOUNT(Inv_Fact_Inventory[CURINV_CARGO_ID])
                                    ,Inv_Fact_Inventory[Dashboard]="Current Inventory"
                                    ,Inv_Fact_Inventory[Inventory Status]="ASSIGNED"
                                    ,Inv_Fact_Inventory[Inventory Order Type]="TENDERED NOT SHIPPED")+ [ShippedCount]

Now from this measure i need to calculate running total, so i tried to use the below measure , but its not returning the correct result

Measure2 := SUMX( FILTER ( Inv_Fact_Inventory, 
						Inv_Fact_Inventory[Dashboard]="Current Inventory" && Inv_Fact_Inventory[Inventory Status]="ASSIGNED" && Inv_Fact_Inventory[Inventory Order Type]="TENDERED NOT SHIPPED" 
						&& Inv_Fact_Inventory[Received Date] <= MAX(Inv_Fact_Inventory[Received Date])),[Measure1])

 

When i checked the database Measure2 is not giving the correct value. Please help here

1 ACCEPTED SOLUTION

You need the date on the x axis for the running total to be calculated over.

jdbuchanan71_0-1594662588493.png

 

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , In Quick measure you have an option for running total, try that if that can work for you

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
jdbuchanan71
Super User
Super User

@Anonymous 

Try it like this.

 

Measure 2 :=
VAR _MaxDate =
    LASTDATE ( Inv_Fact_Inventory[Received Date] )
RETURN
    CALCULATE (
        [Measure1],
        FILTER (
            ALLSELECTED ( Inv_Fact_Inventory[Received Date] ),
            Inv_Fact_Inventory[Received Date] <= _MaxDate
        )
    )

If your model has a calendar table and you are displaying the trending using values from that table you would need to modify the measure to look at the calendar table instead.

 

Anonymous
Not applicable

Hi,

 

I'm not seeing any difference between both the measures. Both are returning the same value as seen below.

 

sarthaks_0-1594661795321.png

 

Here are the measure definition:

 

Measure5 = CALCULATE(DISTINCTCOUNT(Inv_Fact_Inventory[CURINV_CARGO_ID])
                                    ,Inv_Fact_Inventory[Dashboard]="Current Inventory"
                                    ,Inv_Fact_Inventory[Inventory Status]="ASSIGNED"
                                    ,Inv_Fact_Inventory[Inventory Order Type]="TENDERED NOT SHIPPED")



Measure6 = VAR _MaxDate =
    LASTDATE ( Inv_Fact_Inventory[Received Date] )
RETURN
    CALCULATE (
        [Measure5],
        FILTER (
            ALLNOBLANKROW( Inv_Fact_Inventory[Received Date] ),
            Inv_Fact_Inventory[Received Date] <= _MaxDate
        )
    )

 

 

Am i missing something. Pleas advice

You need the date on the x axis for the running total to be calculated over.

jdbuchanan71_0-1594662588493.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.