Forum Discussion

artlearning's avatar
artlearning
Regular Visitor
3 years ago

Create a running total based on another measure

Hello everyone - I need a measure that provide a running total (RT) based on the result of another measure (Shipped). Below my data set and the current output (measures below)

 

DatePaid QtyShippedRT
11/1/2021200
12/1/2021204
1/1/2022200
2/1/2022200
3/1/2022121216
4/1/202212028
5/1/2022141442
6/1/202214056
7/1/202214070
8/1/2022171787
9/1/2022170104
10/1/2022170121
11/1/2022170138
12/1/2022170155

 

Where

 

 

 

 

[Paid Qty]

CALCULATE (
    SUM ([Qty] ),
    Data[Transaction] = "Paid"
)



Where [Paid PM]

CALCULATE (

SUM ( [Qty]),

DATEADD ( Data[Fiscal Date], -1, MONTH )

)



[Shipped]

IF (

[FM ID] = 0, --First month is excluded, this Measure is MAX(FiscalDateID)

0,

IF ( AND ( [Paid Qty] > [Paid Qty PM], [Paid Lics] > 0 ), [Paid Qty], 0 )

)

[RT]

CALCULATE (

[Shipped],

DATESYTD('Data'[Fiscal Date])

)

 

 

 

 

The output I'm looking for is 

 

DatePaid QtyShippedRT
11/1/2021200
12/1/2021200
1/1/2022200
2/1/2022200
3/1/2022121212
4/1/202212012
5/1/2022141414
6/1/202214014
7/1/202214014
8/1/2022171717
9/1/202217017
10/1/202217017
11/1/202217017
12/1/202217017

 

I can't figure this one out, so I'd really appreciate some help!

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi artlearning,

    I'm not so clear how the qty expression calculated. Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

    How to Get Your Question Answered Quickly  

    Regards,

    Xiaoxin Sheng