Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I am trying to create a cumulative total which responds to dates changed in a date slicer.
I did read several other posts about this -- all of which had the same DAX formula:
calc_RunningTotalPrincipal = CALCULATE(SUM(Transaction[Principal]),FILTER(ALL(Transaction[TradeDate]),Transaction[TradeDate] <= MAX(Transaction[TradeDate])))
But, this is not working properly.
I created a simple example with several records. There is a date, transaction type and amount. i.e. 1/1/2017, BUY, $100, Want a running sum of amount based on filters applied -- generally a date slicer. Though curious, if we add other filters -- ie. transaction type -- do we need to define this in the DAX forumla?
Please see screenshots below as example.
Any assistance greatly appreciated.
Thanks,
Dan
Solved! Go to Solution.
You could try a measure as below.
Measure = VAR sumTotal4previousDates = CALCULATE ( SUM ( yourTable[Principal] ), FILTER ( ALLSELECTED ( yourTable ), yourTable[date] < MAX ( yourTable[date] ) ) ) VAR sumTotal4currentDayBuyTrans = CALCULATE ( SUM ( yourTable[Principal] ), FILTER ( yourTable, yourTable[transtype] = "Buy" ) ) VAR sumTotal4currentDayBuyAndSellTrans = CALCULATE ( SUM ( yourTable[Principal] ), ALLEXCEPT ( yourTable, yourTable[date] ) ) RETURN IF ( LASTNONBLANK ( yourTable[transtype], "" ) = "Buy", sumTotal4previousDates + sumTotal4currentDayBuyTrans, sumTotal4previousDates + sumTotal4currentDayBuyAndSellTrans )
You could try a measure as below.
Measure = VAR sumTotal4previousDates = CALCULATE ( SUM ( yourTable[Principal] ), FILTER ( ALLSELECTED ( yourTable ), yourTable[date] < MAX ( yourTable[date] ) ) ) VAR sumTotal4currentDayBuyTrans = CALCULATE ( SUM ( yourTable[Principal] ), FILTER ( yourTable, yourTable[transtype] = "Buy" ) ) VAR sumTotal4currentDayBuyAndSellTrans = CALCULATE ( SUM ( yourTable[Principal] ), ALLEXCEPT ( yourTable, yourTable[date] ) ) RETURN IF ( LASTNONBLANK ( yourTable[transtype], "" ) = "Buy", sumTotal4previousDates + sumTotal4currentDayBuyTrans, sumTotal4previousDates + sumTotal4currentDayBuyAndSellTrans )
Thanks Eric!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
75 | |
63 | |
51 | |
48 |
User | Count |
---|---|
204 | |
86 | |
64 | |
59 | |
56 |