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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
v2
Frequent Visitor

Cumulative calculation based on a Category

Hello,

 

I am completely lost as to how to achieve a cumulative calculation in Power Bi. I am assuming i will need a measure and not a calculated column?

 

I need to create two measures when a category is filtered.  The table1 below is a raw table and when filtered for CAT = "A" then the measures shoud result in cumulative values as table 2 so I can see on a line plot.

 

Thanks in advance.

 

Table 1

DateCATRateHours
11-08-21A0.5173.87
06-08-21A0.5583.58
01-08-21C0.4514.43
30-07-21D0.5743.48
23-07-21C0.5363.73
22-07-21E0.4414.53
10-07-21F0.414.88
03-07-21E0.82.5
01-07-21C0.4674.28
26-06-21B0.553.63
16-06-21A0.6742.97
13-06-21G0.4324.63
08-06-21F0.444.55
07-06-21G0.7232.77
03-06-21H0.414.88
27-05-21H0.5743.48
26-05-21J0.5713.5
24-05-21A0.3216.23
19-05-21B0.7692.6
18-05-21D0.5533.62
17-05-21C0.4434.52

 

Table 2

DateCATRateHoursMeasure1 = Cumulative RateMeasure 2 = Cumulative Hours
11-08-21A0.5173.870.5173.87
06-08-21A0.5583.581.0757.45
16-06-21A0.6742.971.74910.42
24-05-21A0.3216.232.0716.65
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@v2 , Create measures like

 

calculate(sum(Table[Hour]), filter(allselected(Table), Table[category] = max( Table[category]) && Table[date] <= max( Table[date])))

 

 

 

calculate(sum(Table[Rate]), filter(allselected(Table), Table[category] = max( Table[category]) && Table[date] <= max( Table[date])))

Share with Power BI Enthusiasts: 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

2 REPLIES 2
amitchandak
Super User
Super User

@v2 , Create measures like

 

calculate(sum(Table[Hour]), filter(allselected(Table), Table[category] = max( Table[category]) && Table[date] <= max( Table[date])))

 

 

 

calculate(sum(Table[Rate]), filter(allselected(Table), Table[category] = max( Table[category]) && Table[date] <= max( Table[date])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks amitchandak. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors