cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Anonymous
Not applicable

## How to use OR Operator in dax calculation?

How can I write this statement with OR operator so that if these conditions don't meet then I should get "Product Level"

Product Level for Index =
IF(ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level]),"# Exclude",
IF(ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level]),"# Exclude",
IF(ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level]),"# Exclude",
IF(ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster]),"# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="# Exclude","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="# Exclude","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="# Exclude","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="# Exclude","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="Exclude","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="Exclude","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="Exclude","# Exclude",
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="Exclude","# Exclude",RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level]))))))))))))))))
1 ACCEPTED SOLUTION
Super User

@Anonymous , usage of OR with if was wrong , try like

Product Level for Index Test = IF(ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level]) ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level]) ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level]) ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster]) ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])=""||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="# Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="# Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="# Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="# Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="Exclude","# Exclude",RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])

If need use switch

Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56

3 REPLIES 3
Super User

@Anonymous , usage of OR with if was wrong , try like

Product Level for Index Test = IF(ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level]) ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level]) ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level]) ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster]) ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])=""||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="# Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="# Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="# Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="# Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="Exclude" ||
SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="Exclude","# Exclude",RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])

If need use switch

Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56

Super User

@Anonymous , You can use || operator or OR function

example

IF(ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level] || ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level] , "# Exclude", "Other")

You can keep on adding condition with ||

Anonymous
Not applicable
Getting this error after changing to the pipe

Product Level for Index Test =
IF(ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level] ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level] ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level] ||
ISBLANK(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster] ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])=""||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="# Exclude" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="# Exclude" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="# Exclude" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="# Exclude" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Market Level])="Exclude" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])="Exclude" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Level])="Exclude" ||
IF(SELECTEDVALUE(RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Customer Cluster])="Exclude","# Exclude",RB_RGM_PAT_O_99_PowerBI_PAT_Output[◊ Product Level])))))))))))))))))

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors