Forum Discussion
last week count not working properly
I have a date table which formulates all the dates for given field.
Now i have a field which says- task end date through which i calculate last week tasks- for some reason total tasks are coming exact but not exact when go for individual category.
In power BI its coming as :
The last week tasks are counted using :
This measure- Total_tasks_filterd is working perfect when counting all rows for last week :
I am not sure why this is happening, i am not able to debug. Any help would be appreciated.
Many thanks!
12 Replies
- amitchandak
Super User
Have these new columns in Date Table, Week Rank is Important in Date/Week Table
Week Rank = RANKX('Date','Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense) //YYYYWW format
These measures can help
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))Power BI — Week on Week and WTD
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/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8
Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510- Dwivedi15
Helper I
Hi This does not work for me, as now even the total number of rows arent coming out correct!
- Dwivedi15
Helper I
Hi , This week rank is not working out for me, now even the overall number is not coming correct!
- lbendlin
Super User
Your MaxWeekNumber calculation needs to be corrected to calculate the proper max week of the prior year ( for current week =1 )
- Greg_Deckler
Community Champion
Dwivedi15 In response to your private message. One thing I noticed immediately is that in your Date table, you only have 6 dates for last week (7/2/2023). Looks like you are missing Saturday the 8th. Perhaps this is causing some of your problem?
- Dwivedi15
Helper I
Hi greg,
PBIX- https://drive.google.com/file/d/1faZg-lGf7mCdmayB3VfHwrg9-VeW1_Rn/view?usp=sharing
Excel for just last week: https://docs.google.com/spreadsheets/d/1E3NAOYTqcfqmQSDpNEYI-ykK3U8AsS0v/edit?usp=sharing&ouid=109892159618108648816&rtpof=true&sd=true
If you see here indiviual count of tasks are not coming correct but overall is coming right. Also total aborts works just fine.
REally cant understand why !!!?