Forum Discussion
Getting help with this complicated DAX question
- 2 years ago
The LASTDATE filter will adjust the filter context to only return a single date. COUNTROWS then calculates the employee count for that date (month).
I have tested it out and I kinda see how it works, on a visual level. But does DAX know that the last date of the month is e.g. 31st of December? How does using different date columns of different table affect the count, how does it know without using like Distinct Count or something?
fyi when i did this just to test it out... why is it like this?
- TomMartens2 years agoSuper User
Hey YoungLearning ,
as AlexisOlson mentioned LASTDATE returns the last date of the filter context. The date hierarchy present in the table view is "contributing" to the filter context of the cell that shows the result of your LASTDATE measure. Each cell has a different filter context, for this reason the measure returns a different value in each cell. If you remove the day column from the table you will see that LASTDATE will return the last date of the month.
Regards,
Tom
- YoungLearning2 years agoHelper III
Yes, seems like it. But back to the original question now. Why not the Headcount[date] column, why Date[date]? This columns have a relationship.
- YoungLearning2 years agoHelper III
It wants to count the number of employees, year, month and quarter basis. COUNTROWS definitely double count if I do it by year or quarter.