Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I'm trying to create a measure to filter some data by multiple date fields and values.
I've managed to create a measure to get the No Required where the Date Approved is not 1st August 2022 and is not blank:
Measure =
Solved! Go to Solution.
Try it like this.
Your Measure =
CALCULATE (
[No Required],
Table[Date Approved] <> DATE(2022,08,01) &&
Table[Date Approved] <> BLANK()) &&
(
Table[Date Offer Accepted] <> DATE ( 2022, 08, 01 ) ||
Table[Date Offer Accepted]] <> BLANK ()
)
)
Perfect thanks for your help
Try it like this.
Your Measure =
CALCULATE (
[No Required],
Table[Date Approved] <> DATE(2022,08,01) &&
Table[Date Approved] <> BLANK()) &&
(
Table[Date Offer Accepted] <> DATE ( 2022, 08, 01 ) ||
Table[Date Offer Accepted]] <> BLANK ()
)
)
OK thanks - I needed || instead of &&
I've now managed to get to the correct number by doing 2 separate measures, and referencing the first measure in the second:
Measure 1:
That's becuase these two lines will not let any rows come through.
&& Table[Date Offer Accepted] = BLANK()
&& Table[Date Offer Accepted] = DATE(2022,8,1))
No line will have [Date Offer Acceted] = BLANK() AND [Date Offer Acceted] = 2020-8-1
Thanks for your reply. I tried that measure you suggested but it doesnt return any results.
I do have a DimDate table in my model but i deleted the relationship to try and understand it better. I can recreate the relationship to go from
Table [Date Approvd] = DimDate [Date]
It looks like you have the closing ) of your CALCULATE in the wrong place with the new filters.
Also, if you are referencing a date filed like Table[Date Approved], there is no need to use Table[Date Approved].[Date]. The .[Date] is only there becaue you don't have a calendar table in your model and you really should have one. Try the measure like this and see if it works.
Measure =
CALCULATE([No Required],
Table[Date Approved] <> DATE(2022,8,01)
&& Table[Date Approved] <> BLANK()
&& Table[Date Offer Accepted] = BLANK()
&& Table[Date Offer Accepted] = DATE(2022,8,1))