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

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

Reply
Mgau63100
Regular Visitor

Cumulative total in dax

Hi All

 

Could you please help me in achieving below results in dax :

 

Table:1

Eventdate                Number      Output 

 

01/08/2020 01:00.          0.             0

01/08/2020 01:30.           1.             1

01/08/2020 01:38.            1.             2

01/08/2020 01:58.            1.             3

01/08/2020 03:00.            0.             0

01/08/2020 04:00.             1.             1

01/08/2020 05:00.             0.             0

 

 

If we have 1 then add else 0. It should work on filter also like if I want to filter between 3 pm to 5pm then it should consider only data between intervals .

 

We need output in dax as measure 

 

 

2 REPLIES 2
Fowmy
Super User
Super User

@Mgau63100 

This measure should work for you:

Measure = 
VAR V2 = CALCULATE( MAX('Table'[Date]), FILTER( ALL('Table'), 'Table'[Date] < MAX('Table'[Date]) && 'Table'[Number]=0))
VAR V1 = 
IF( MAX( 'Table'[Number] )  = 0 , 0,
CALCULATE(
    SUM('Table'[Number]),
    FILTER(
        ALL('Table'),
        'Table'[Date] <= MAX('Table'[Date]) && 'Table'[Date] > V2  )
    )
)
RETURN
V1

Fowmy_0-1600285315662.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thank you for sharing the measure formula. It is working fine but when i am doing any filters it should adjust accordingly which is not happening. e.g IF i want to filter between 2 dates or time stamps then formula should calculate from 1st element not before that. Is there anyway to do that ?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.