Forum Discussion

SDBoots's avatar
SDBoots
New Member
2 years ago
Solved

IF function when more than one true value

Hello, I have a column in my power BI report that reads 'BA' with 5 data available values. I need to add an if function to read if BA = B and/or G then Data source must equal B. Where BA is anything else e.g O, P, W and blank data source must equal H. Can someone help confirm what the correct formula should read, everytime I try it tells me an error.

 

  • Hi SDBoots 

    Use below DAX

     

    = If(Table[BA] IN {"B","G"},"B","H")

     

     


    Let me know if that works for you


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin

  • SDBoots 

    create a calculated column as below : 

    cc = 

    switch(true(), 

    tbl_name[BA_Col_name] in {"B","G"} , B , blank() ) 

     

    let me know if this works 

     

    If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

2 Replies

  • PijushRoy's avatar
    PijushRoy
    Community Champion

    Hi SDBoots 

    Use below DAX

     

    = If(Table[BA] IN {"B","G"},"B","H")

     

     


    Let me know if that works for you


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    SDBoots 

    create a calculated column as below : 

    cc = 

    switch(true(), 

    tbl_name[BA_Col_name] in {"B","G"} , B , blank() ) 

     

    let me know if this works 

     

    If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠