Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I am new to this community and looking for a help with a measure (dax) having if statement on date column.
I have one date slicer where the date is coming from a "Date" table. I have another table called "Online/Offline" where I have made a relationship as below.
Now, I wanted to insert one measure with the below logic.
IF the date selected is less than equal to (<=) "7/31/2022" then return 480, if the date selected is >= "8/1/2022" and ResearcherName (which is a text column in "Online/Offline" table) = "Sajid (it could be any other researcher name)" then return 440 or else 385.
I have applied one dax as below, but it is not giving me the desired result.
Result that I am getting is,
As you can see above in highlighted, The date selected is 8/1/2022 till 8/4/2022 but the value that I am getting is 480 for all the researchers.
The expected result for the date selected >= 8/1/2022
The expected result for the date selected <= 7/31/2022
It would be a great help if somebody can help me in this.
Many thanks in advance.
Solved! Go to Solution.
Because your date slicer is a range SELECTEDVALUE('Date'[Date]) won't work - there is not a single value. You would need to either change the slicer to a list or dropdown, forcing the user to select a single date, or else change the SELECTEDVALUE('Date'[Date]) to MIN('Date'[Date]) or MAX('Date'[Date]), depending on which is more appropriate for your use case.
Because your date slicer is a range SELECTEDVALUE('Date'[Date]) won't work - there is not a single value. You would need to either change the slicer to a list or dropdown, forcing the user to select a single date, or else change the SELECTEDVALUE('Date'[Date]) to MIN('Date'[Date]) or MAX('Date'[Date]), depending on which is more appropriate for your use case.
User | Count |
---|---|
98 | |
90 | |
82 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
66 |