Forum Discussion
Convert DAX to M Code
- 4 years ago
You're not getting your 'Future Booked' outputs because your first condition is negating it.
Your first condition reads as:
if [interviewDate] is yesterday or later then 'No result'
Your 'Future Booked' condition reads as:
if [interviewDate] is today or later then "Future Booked"
Can you see how your second condition has already been evaluated as part of the first condition?
The calculation that you posted right at the start of this thread had the first condition as:
if [interviewResult] is blank and [interviewDate] was yesterday or earlier then "No result". It looks like this condition has changed in the evolution.
Here's your original (presumably working as required) DAX calculation, properly converted to M code (because I'm nice like that):
let Date.Today = Date.From(DateTime.LocalNow()) in if [InterviewDate] = null then null else if [InterviewResult] = null and [InterviewDate] <= Date.AddDays(Date.Today, -1) then "No Result" else if [InterviewResult] = null and [InterviewDate] >= Date.Today then "Future Booked" else if [InterviewResult] = "Attended" then "No Result" else if [InterviewResult] = "Failed to Attend" then "FTA" else [InterviewResult]Pete
Since M-code is case sensitive, did you try with null intead of Null and "if " (with space) instead of "if"?