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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Saqibmughal00
Helper I
Helper I

Help in counting cumulative for each category separately

Hi, 

 

I am trying to create a cumulative value for each category as pictured. I tried below DAX but its not giving me cumulative but a weekly data again.

"

Cumulative C&I Earned Hours =
CALCULATE(
    [C&I Earned Hours],
    FILTER(
        ALLSELECTED('C&I PROGRESS FOR PF ANALYSIS'[Value]),
        ISONORAFTER('C&I PROGRESS FOR PF ANALYSIS'[Value], MAX('C&I PROGRESS FOR PF ANALYSIS'[Value]), DESC)
    )

"

 

can someone Help please

 

Saqibmughal00_0-1747284213984.png

 

1 ACCEPTED SOLUTION

Hi @Saqibmughal00, 
Thank you for reaching out to the Microsoft fabric community forum. Thank you @maruthisp, for your input on this issue 
 
After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.   

  

Dax Measure: 

Cumulative Value by Description = 
VAR CurrWeek = MAX(CIPFAnalysis[Week Ending])
VAR CurrDesc = SELECTEDVALUE(CIPFAnalysis[Description])
RETURN
CALCULATE(
    SUM(CIPFAnalysis[Value]),
    FILTER(
        ALLSELECTED(CIPFAnalysis),
        CIPFAnalysis[Week Ending] <= CurrWeek &&
        CIPFAnalysis[Description] = CurrDesc
    )
)

Output: 

vsaisraomsft_1-1747308631148.png

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly. 
 
Thank you.

   

View solution in original post

4 REPLIES 4
maruthisp
Super User
Super User

Hi @Saqibmughal00  ,

I hope you have created a measure for EarnedHours, something like below:
EarnedHours =
SUM( CIPFAnalysis[EarnedHours] )

Then, I am creating cumulative based on the above measure with some range:
CumulativeEarnedHours =
VAR CurrCategory = SELECTEDVALUE( CIPFAnalysis[Category] )
VAR CurrWeek = MAX( CIPFAnalysis[WeekEnding] )
RETURN
CALCULATE(
[EarnedHours],
FILTER(
ALLSELECTED( CIPFAnalysis ),
CIPFAnalysis[Category] = CurrCategory
&& CIPFAnalysis[WeekEnding] <= CurrWeek
)
)

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X






It didnt work and My measure for earned hours is as below:

Saqibmughal00_0-1747285469207.png

 

Hi @Saqibmughal00, 
Thank you for reaching out to the Microsoft fabric community forum. Thank you @maruthisp, for your input on this issue 
 
After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.   

  

Dax Measure: 

Cumulative Value by Description = 
VAR CurrWeek = MAX(CIPFAnalysis[Week Ending])
VAR CurrDesc = SELECTEDVALUE(CIPFAnalysis[Description])
RETURN
CALCULATE(
    SUM(CIPFAnalysis[Value]),
    FILTER(
        ALLSELECTED(CIPFAnalysis),
        CIPFAnalysis[Week Ending] <= CurrWeek &&
        CIPFAnalysis[Description] = CurrDesc
    )
)

Output: 

vsaisraomsft_1-1747308631148.png

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly. 
 
Thank you.

   

Thanks for the solution and it worked on one end but there is small issue which appeared.

the cumulatives are counted based on last week but I have separate modules (they are small scopes which contribute to earn hours) and I can see no weekly data but have cumulative for the full period selected above drawn on their chart. 

Saqibmughal00_0-1747363164927.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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.