Forum Discussion
Null values creating new errors in edit query conditionals
Hi all,
I have an employee data report where I have added a number of conditional statements to determine things like which employees were hired in specific timeframes, termed in specific timeframes, etc. I haven't changed anything in the source files or the report, but between last week's report run and this week's, all of my conditional query strings are giving off errors anytime there is a null value. Previously, the "else" final default command addressed these, but I have no idea why these are throwing off error codes now.
Is there a setting in PowerBI to change the functionality and allow the final "else" clause to include nulls and just return a zero or null as I have done in the past? I implemented a workaround here to add steps to replace all errors with "null," but something changed for me this past week and I would really like to figure it out!
Here is an example of the conditional I have always been sucessful with in the past. (you can skip the comments about how I should be writing measures instead, I learned PowerBI via YouTube videos and haven't progressed that far yet :))
And here is a screenshot of the errors I am getting for the first time... all of them appear to relate to when the conditional is referencing a null value. Again, no changes in anything, but previously, these just returned the zero or null I wanted. Now, throwing off errors.
One workaround seemed to be adding a conditional line to address the null values, but then I figured it was easier to just replace the errors with zeros.
9 Replies
- PC2790Community Champion
In the screenshot given you have given, there are two dates that you are considering-HireDate and TermedDate. Is that right?
Also, would you check the values where the errors are being thrown. Could be that there is a change in the text -null and hence the condition is not working.
- AnonymousNot applicable
Yes, there are multiple date fields, including hire date, term date and some calculated values like 1 year prior to current date to enable the conditional lookups and categorize people within different timeframes.
Nothing in the data or report changed that I know of, so the quandry is really why I am getting these errors this week when I wasn't last week. There was no change in the null value, it is a generated value from Sequel to ensure that date columns only have date values or are blank/null.
- AlexisOlsonSuper User
What does the error message say and what does your M code look like (you can paste it from the Advanced Editor)?
My initial guess is that it might be interpreting null as a string "null" rather than an empty date value but I can't tell if that's the case from your screenshots or not.
- AnonymousNot applicable
Sorry, I didn't even realize I could click on the "error" to get more details... here is the error:
- AlexisOlsonSuper User
Interesting. It sounds like you have some sort of if null then ... rather than if x = null then ... happening.
Please share the M code.