Skip to main content
cancel
Showing results for 
Search instead 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.

Reply
cz1750
Frequent Visitor

Nested IF and OR n DAX

Hi,

 

I have been trying to add calcualted columns in Power BI but I keep getting it wrong. Does anyone know how to create a calcualted colum that is based on IFs and Ors like the following?

 

If (Table[value1] IN ("ABC","DEF,"GHI")  AND Table[value2] = 200 ) THEN
   'Type A'
Else If (

             (Table[value1] = "GGG"  AND Table[value2]  IN (100,300) )

         )

         OR

        (

           (Table[value1] = "III" 

       )

  THEN  
       'Type B'
Else
  'Type C'
End If  

 

 

Thanks

 

John

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@cz1750

 

try

 

Column =
IF (
    'Table'[value1] IN { "ABC", "DEF", "GHI" }
        && 'Table'[value2] = 200,
    "Type A",
    IF (
        'Table'[value1] = "GGG"
            && 'Table'[value2] IN { 100, 300 },
        "Type B",
        "Type C"
    )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

@cz1750

 

try

 

Column =
IF (
    'Table'[value1] IN { "ABC", "DEF", "GHI" }
        && 'Table'[value2] = 200,
    "Type A",
    IF (
        'Table'[value1] = "GGG"
            && 'Table'[value2] IN { 100, 300 },
        "Type B",
        "Type C"
    )
)

Regards
Zubair

Please try my custom visuals

Hi,

 

Thanks for your reply  - that worked.

 

 

Thanks

 

John

@cz1750,

 

By the way, you may help accept solution. Your contribution is highly appreciated.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

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

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors