Forum Discussion
filter empty fields within true/false column
- 5 years ago
Applicable88 yes it matters, check this post Handling BLANK in DAX - SQLBI
Also, you can simply your expression:
if ( 'Table'[Flag]==blank() || 'Table'[Flag]= False(), "active", "inactive")Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- 5 years ago
Hi, Applicable88
According to your description, I can roughly understand your requirement, you want the column value to be “active” when the status is false and “inactive” when the status is true, right? I think you can simply achieve this using the SWITCH() function in DAX, You can try this DAX formula:
Column = SWITCH( [Status], FALSE(),"active", TRUE(),"inactive", "inactive")And you can get what you want.
More info about the SWITCH() function in DAX
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Applicable88
According to your description, I can roughly understand your requirement, you want the column value to be “active” when the status is false and “inactive” when the status is true, right? I think you can simply achieve this using the SWITCH() function in DAX, You can try this DAX formula:
Column =
SWITCH(
[Status],
FALSE(),"active",
TRUE(),"inactive",
"inactive")
And you can get what you want.
More info about the SWITCH() function in DAX
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Applicable885 years agoImpactful Individual
v-robertq-msft parry2k Anonymous ,
thank you very much. parry2k , if you woulnd't have mention it, I hardly would know that its better to evaluate blanks first in a nested if - statement.
In that article I found out that its also best practice to do so with the switch() function, so it surprised me a bit to see the above example of v-robertq-msft still fill out "inactive" for the empty cells correctly.
Best regards.