Forum Discussion
Cumulative Count by Week
Hi Power BI Users,
I am having an issue with Cumulative Count by week. Here is the sample data i am working on :
Sample Data
This shows the tickets opened on a date and its corresponding week_number.
We want to plot the data on the weeknum level with Cumulative count like this :
Output1
Any help would be deeply appreciated.
Thanks,
DeepakJha23 - You could create a measure like this:
Cumulative Count = VAR __Week = MAX('Table'[Week_Num(Date)]) RETURN SUMX(FILTER('Table',[Week_Num(Date)]<=__Week),[TicketCount])Hello @DeepakJha23
here's my solution. It is very closed to @Greg_Deckler solution:
Sum of Ticket Count = SUM('Table'[Ticket Count]) Cumulative Count = CALCULATE( [Sum of Ticket Count], FILTER( ALL('Table'), 'Table'[Week_Num(Date)] <= MAX('Table'[Week_Num(Date)]) ) )With kind greetings from the city where the legend of the 'Pied Piper de Hamelin' is at home
FrankAT (Proud to be a Datanaut)
3 Replies
- Greg_DecklerCommunity Champion
DeepakJha23 - You could create a measure like this:
Cumulative Count = VAR __Week = MAX('Table'[Week_Num(Date)]) RETURN SUMX(FILTER('Table',[Week_Num(Date)]<=__Week),[TicketCount]) - FrankATCommunity Champion
Hello @DeepakJha23
here's my solution. It is very closed to @Greg_Deckler solution:
Sum of Ticket Count = SUM('Table'[Ticket Count]) Cumulative Count = CALCULATE( [Sum of Ticket Count], FILTER( ALL('Table'), 'Table'[Week_Num(Date)] <= MAX('Table'[Week_Num(Date)]) ) )With kind greetings from the city where the legend of the 'Pied Piper de Hamelin' is at home
FrankAT (Proud to be a Datanaut) - amitchandakSuper User
DeepakJha23 , as you have date you can use a date calendar and measure like this (You can have week table with week date)
. Make sure week is taken from week table
example
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=max(Sales[Sales Date])))Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(Week,Week[Week] <=maxx(Week,Week[Week])))
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(Week),Week[Week] <=maxx(Week,Week[Week])))also refer
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.