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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Cumulative sum of last 4 weeks keeping slicers

Hello,

 

I am trying to calculate cumulative sum of tickets in last for weeks. So week 23 displays sum of weeks 23+22+21+20, week 22 displays sum of weeks 22+21+20+19, etc

The dataset is transactional (Date, TicketID, Status). I managed to make a summary table of total tickets per week and calculate the cumulative value of last 4 weeks.

1.png

 

However, now the dataset has changed.  The data broken down to Department and Sector (Date, TicketID, Status, Department, Sector), so i would like to allow users to slice data and calculate cumulative values based on WeekNum, Department and Sector.

2.png

 

Could you please help amending the DAX formula so it allows slicing by Depratment and Sector?

 

CALCULATE( SUM(CumTickets[Defects]), DATESINPERIOD( 'Calendar'[Dates], LASTDATE( 'Calendar'[Dates]), -22, DAY ))

 

 Thanks

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try the following formula:

 

Measure = 
CALCULATE( 
    SUM(CumTickets[#Tickets]),
    ALLEXCEPT( CumTickets, CumTickets[Department], CumTickets[Sector] ), 
    DATESINPERIOD( 'Calendar'[Date], LASTDATE( 'CumTickets'[Start Of Week]), -22, DAY )
)

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try the following formula:

 

Measure = 
CALCULATE( 
    SUM(CumTickets[#Tickets]),
    ALLEXCEPT( CumTickets, CumTickets[Department], CumTickets[Sector] ), 
    DATESINPERIOD( 'Calendar'[Date], LASTDATE( 'CumTickets'[Start Of Week]), -22, DAY )
)

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

ryan_mayu
Super User
Super User

@Anonymous 

 

could you pls provide the pbix file?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Users online (9,172)