Forum Discussion
Calculate function - filter
- 4 years ago
I don't think the post initiator, so far, wraps his/her head around my solution in another post of his/hers.
Solved: How to reference a value on related table - Microsoft Power BI Community
CALCULATE filters are actually tables.Indeed, this is how filters works in DAX. It's an explicit leveraging of Expanded Table in such statements, CALCULATE( XXX, Table ).
CALCULATE filters are actually tables. As per your data model the Calendar table filters the Table1. But in the code you mentioned, Table1 filters the Caledar date column.
The difference is that without using Table1 as a filter the code will return all the dates in the Calendar table. While using when using Table1 as a filter then all the months that are missing from Table1 will return blank. It seems that the user does not want to see the number of days for those months.
tamerj1 this is not accurate. The Calendar table would be filtered by any dates in filter context, which would in turn filter any dates in Table1.
But the discussion is irrelevant because using CALCULATE is over-complicating the solution in the first place. DAY(EOMONTH('Calendar'[Date], 0)) solves the problem. More simply, ENDOFMONTH solves the problem.
- CNENFRNL4 years ago
Community Champion
Funny discussion, I'm wondering whether you ever ask youself a simplest but fairly intuitive question, what's the point of existence of ENDOFMONTH since there already exists EOMONTH?
- tamerj14 years ago
Community Champion
The dates in filter context are actually and should be from the date table. Therfore, when I write a measure that returns the last day of a month and I place it in a matrix visual for example and I slice by date from the date table, I will have to see all the dates in the raws of my matrix even if they do not exist in my fact table. The idea is to restric this date filter to only the dates that exist in the fact table or alternatively return blank in case othe measures that forces all dates to appear do exist in the same matrix visual.