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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
drrai66
Resolver I
Resolver I

Need Help on This Formula

Hello Experts,

I need to convert This Tableau Logic to Power BI, But I am Stuck. Not getting it to work. Please Help

 

IF [Status]="TRUE"
THEN
IF CONTAINS(Languages,".net")
OR
CONTAINS(Languages,"Java,")
THEN "True"
ELSE "False"
END
END

 

The Logic First Check if the Status  Is TRUE, Then for those TRUE Values, It Checks , If The Languages Column Contains ".net" OR "Java", If it Does, Then Returns True Else False.

So it is Double IF Statement. How to Write it in POWER BI???

 

Thanks in Advance

Deepak

1 ACCEPTED SOLUTION

Thanks Phil and Ashish, I got it Working . This is My Actual Calculation and It is working Perfectly. Thank you Guys for Support.

Thanks

Deepak

Here is Formula I used

 

IF('Merged Project Data'[Java Script Check 1]>0,IF(ISERROR(SEARCH("Java,",'Merged Project Data'[Language])) && ISERROR(SEARCH(".net",'Merged Project Data'[Language]))&& ISERROR(SEARCH(".NET",'Merged Project Data'[Language]))&& ISERROR(SEARCH("C#",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Microsoft.Net",'Merged Project Data'[Language]))  && ISERROR(SEARCH("Objective-C",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Python",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Ruby",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Siebel",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Proc",'Merged Project Data'[Language]))&& ISERROR(SEARCH("J2EE",'Merged Project Data'[Language])) ,0,'Merged Project Data'[Apps With Platform]))

View solution in original post

10 REPLIES 10
Ashish_Mathur
Super User
Super User

Hi,

 

Try this calculated column formula

 

=IF([Status]="TRUE",IF(OR(ISNUMBER(SEARCH(".Net",[Language])),ISNUMBER(SEARCH(".Java",[Language]))),TRUE(),FALSE()),FALSE())

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry Ashish,

I think You used ISNUMBER(Search... ,but I am Searching for things like .net, Java, C# in Language Column So I am getting Error. So Solution is not Working

Thnaks

Deepak

I do not understand.  Show your data and creiteria.  Where is my formula giving the wrong result?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks Phil and Ashish, I got it Working . This is My Actual Calculation and It is working Perfectly. Thank you Guys for Support.

Thanks

Deepak

Here is Formula I used

 

IF('Merged Project Data'[Java Script Check 1]>0,IF(ISERROR(SEARCH("Java,",'Merged Project Data'[Language])) && ISERROR(SEARCH(".net",'Merged Project Data'[Language]))&& ISERROR(SEARCH(".NET",'Merged Project Data'[Language]))&& ISERROR(SEARCH("C#",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Microsoft.Net",'Merged Project Data'[Language]))  && ISERROR(SEARCH("Objective-C",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Python",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Ruby",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Siebel",'Merged Project Data'[Language]))&& ISERROR(SEARCH("Proc",'Merged Project Data'[Language]))&& ISERROR(SEARCH("J2EE",'Merged Project Data'[Language])) ,0,'Merged Project Data'[Apps With Platform]))

This Should also work, Because I was Tryig with ISERROR(Serach type of logic, but got stuck at Last False. I think, I should have written another False as you wrote 2 false(). I was getting it OK, Except False in my Results.

Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @drrai66

 

This calculated column gets close

 

Column = 
    SWITCH(
        TRUE() ,
        'Table2'[Status] = "TRUE" && 
            (
                SEARCH(".net",'Table2'[Languages],1,0)>0 ||
                SEARCH("Java",'Table2'[Languages],1,0)>0
                ) , "True" ,
        "False"
    )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Sorry Phil,

The Solution Is not Working, It is Not Searching with in TRUE Values For The Languages we put in the Next Statement, It Is Just Returing TRUE for  Even Those Languages which we have not searched for. In The above Example, it should return TRUE only if Finds .net and Java in Language Column.

Thanks

Deepak

I Think this should be OK. In my actually data, I have 16 OR Statements, so tomorrow I would apply, verify and come back to you with good news.

Thanks a lot

Deepak

In that instance, I would probably put all your search terms into a table on their own and re-write the calculation to join to the reference table..


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Actually, Status and Languages are Column of Same Table and I seek To Create Another Calculated Column in the Same Table, So I think, Your Logic would work.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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