Forum Discussion
Excluding Future Years from DAX Code
Thanks for your response.
I modified 7.1.3.1 to just return the Result, but it doesn't work.
It returns BLANK for 2024 in both the Line Chart AND in the Card; which is the reason why I added the logic to return 0 instead of BLANK.
Regards,
Nathan
P.S. Of lesser importance, I hear what you are saying as far as the explanation for 7.1.3.2, but it doesn't make sense based on how I've seen similar filters work within CALCULATE. But thank you for trying to help me understand.
Nathan,
Is 'D Year'[PolicyYear_Int] your x-axis? If so, are there records in your 'D Year' table with a [PolicyYear_Int] of 2024? If so, that's possibly why it's behaving that way.
Also, my explanation for 7.1.3.2 makes perfect sense to me so if you were still interested, feel free to share any specific examples of similar filters working differently and I'll see if I can figure out the difference - because clearly there is one. The important thing of note (to me, anyway) is understanding filter conditions in the CALCULATE function override existing filters on those fields as a default behaviour. If you wanted to add your filter condition to the filter context, try wrapping it in a KEEPFILTERS function.
For example, check out the below screenshot from this resource from SQLBI:
----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)