Forum Discussion
Calculate function - filter
I am trying to understand this DAX code here.
Why do we have Table1 here?
I thought extra line is for filter (or extra filters), but this is only table name.
There is a relationship between 'Calendar' table and 'Table1' table.
Update:
I have attached Pbix file for better illustration.
Sorry for confusions.
Thanks.
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 ).
16 Replies
- tamerj1Community Champion
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.- CNENFRNLCommunity Champion
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 ).
- JustinDoh1Post Prodigy
CNENFRNL Sorry. I should have posted my follow up question to your response on other post. I guess the answer is "it's an explicit leveraging of Expanded Table in such statements". Thank you!
- littlemojopuppyCommunity Champion
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.
- CNENFRNLCommunity 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?
- littlemojopuppyCommunity Champion
Hi JustinDoh1 what is Table1?
I would think that just DAY(EOMONTH('Calendar'[Date], 0)) would be enough?- JustinDoh1Post Prodigy
Table1 is a name of a table.
I am getting error mesage.
Update:
I have updated the Pbix file, and bottom are illustrations of two cases:- littlemojopuppyCommunity Champion
JustinDoh1 I assumed it was a table. Whole thing seems unnecessary.
I didn't use ENDOFMONTH. I used EOMONTH (returns the last day of a month with offset by number of months).