Reputation: 21
I'm trying to compare a date column with date measure whose value is taken from the Calendar slicer.
Week_Start_Date = CALCULATE(Min('Calendar'[Date]),ALLSELECTED('Calendar'))
Week_End_Date = CALCULATE(Max('Calendar'[Date]),ALLSELECTED('Calendar'))
Submissions_Week_Flag = IF('Tracker'[Submitted Date].[Date] >= [Week_Start_Date] && 'Tracker'[Submitted Date].[Date] <= [Week_End_Date],1,0)
But all my flags are turned 1. How do I compare the dates in this scenario. There is no relationship between the 'Calendar' table and 'Tracker' table.
Upvotes: 0
Views: 3612
Reputation: 1
I have also run into the same problem. When manually changing the measure "Week_Start_Date" or "Week_End_Date", this causes Power BI to recalculate associated fields, so the "Submissions_Week_Flag" gets updated.
When you switch to using the dynamic values in "Week_Start_Date" or "Week_End_Date", changing the filter changes the values in those measures, but it doesn't cause "Submissions_Week_Flag" to recalculate, so it is using whatever default value is stored in either measure.
As others suggested, the way around this is to create the flag as a measure instead of a calculated column.
Upvotes: 0