Forum Discussion

Dwivedi15's avatar
Dwivedi15
Icon for Helper I rankHelper I
3 years ago

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 :

total tasks Last week =
Var CurrentWeek=Weeknum(today())
var CurrentYear=Year(today())
Var MaxWeekNumber=Calculate(max('Date'[Week Number]),all('Date'))
return
sumx(filter(all('Date'),if(CurrentWeek=1,'Date'[Week Number]=MaxWeekNumber && 'Date'[Year]=CurrentYear-1,
'Date'[Week Number]=CurrentWeek-1 && 'Date'[Year]=CurrentYear)),[Total Tasks_filtered])

Total Tasks_filtered =
CALCULATE(COUNTROWS('Task Volumes'),'Task Volumes'[Project Ref]<>"TOOLING_CHECK" && 'Task Volumes'[Project Ref]<>"VAN_PLANT" && 'Task Volumes'[Management Area]<>"T.POPE")

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