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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
RobRayborn
Helper III
Helper III

Running Totals of a Measure

First of all, I am calculating the Day over Day difference % using the DAX Measure below. My problem is now I need to create a rolling cumulitive total starting from the frist date provided to the last date entered.  The DAX measure = CALCULATE( PD % Diff, Filter,(ALLSELECTED( fDates ), fDates [Date] <= Max ( fDate[Dates]))) isn't providing me with a daily running cumulitive total.  What am I missing here?

 
 
 
PD % Diff =
VAR _currentdate =
    MAX ( fDates[Date] )
VAR _lastnonblank =
    CALCULATE (
        LASTNONBLANK ( fDates[Date], [Inventory Value LC] ),
        FILTER ( ALL ( fDates[Date] ), fDates[Date] < _currentdate )
    )
VAR _lastnonblankvalue =
    CALCULATE ( [Inventory Value LC], fDates[Date] = _lastnonblank )
RETURN
    IF (
        NOT ISBLANK ( [Inventory Value LC] ) && HASONEVALUE ( fDates[Date] ),
        DIVIDE ( [Inventory Value LC] - _lastnonblankvalue, _lastnonblankvalue )
    )
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@RobRayborn ,Assuming fDates is a date table

 

CALCULATE( Sumx(Values(fDates [Date]), [PD % Diff]) , Filter,(ALLSELECTED( fDates ), fDates [Date] <= Max ( fDate[Dates])))

 

 

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@RobRayborn ,Assuming fDates is a date table

 

CALCULATE( Sumx(Values(fDates [Date]), [PD % Diff]) , Filter,(ALLSELECTED( fDates ), fDates [Date] <= Max ( fDate[Dates])))

 

 

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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