Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
TomGee
New Member

Tableau Calculated Field to DAX/Power BI Calculated Col

I'm trying to convert a tableau solution to Power BI and am ready to slam my computer against a wall. It seems that everything is harder than it needs to be.

I simply want to produce an "A" or "B" result based on a whole set of and/or conditions. Simple in Tableau or SQL but I can't make it work in Power BI / DAX. Open to any suggestions: 

Here's what it looks like in Tableau - how do I do this in power BI??

IF ( [Employed] = 'F'
and (
([Current Status]) ='A'
OR ([Current Status]) ='B'
OR ([Current Status]) ='C'
OR ([Current Status]) ='D'
OR ([Current Status]) ='E'
))

OR

( [Employed] = 'T'
and (
([Current Status]) ='G'
OR ([Current Status]) ='H'
OR ([Current Status]) ='I'
OR ([Current Status]) ='J'
))

OR (([Current Status] ='E' and [Naics]<>'92'))

then 'BAD' else 'GOOD' END

 

Any help would be GREATLY appreciated!

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @TomGee ,

 

I'm assuming you are making a calculated column, try the following code:

 

Column =
SWITCH (
    TRUE (),
    Table[Employed] = 'F'
        && Table[Current Status] IN { 'A', 'B', 'C', 'D', 'E' }, "Bad",
    Table[Employed] = 'T'
        && Table[Current Status] IN { 'G', 'H', 'I', 'J' }, "Bad",
    Table[Current Status] = 'E'
        && Table[Naics] <> '92', "Bad",
    "GOOD"
)

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @TomGee ,

 

I'm assuming you are making a calculated column, try the following code:

 

Column =
SWITCH (
    TRUE (),
    Table[Employed] = 'F'
        && Table[Current Status] IN { 'A', 'B', 'C', 'D', 'E' }, "Bad",
    Table[Employed] = 'T'
        && Table[Current Status] IN { 'G', 'H', 'I', 'J' }, "Bad",
    Table[Current Status] = 'E'
        && Table[Naics] <> '92', "Bad",
    "GOOD"
)

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks so much!

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.