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.
Hi all !
As you can see in the screenshot below, I have different titles in one colomn that I would like to sort into 2 categories. I have written the formula in Excel but I don't know how to translate it to Power BI (especially because of the function COUNTIF).
Here is the Formula I wrote in Excel :
=IF(OR(COUNTIF([@[Raw Title]],"Mr"),(COUNTIF([@[Raw Title]],"Heer"))),"Men","Women")
Thank you in advance for you help !
Solved! Go to Solution.
Basically, COUNTIF os translated into CALCULATE(COUNT(countable item/column), <condition>)
So, depending on whether you want the calculation as an added column or as a measure, the direct translation will look like
=IF(CALCULATE(COUNT(Table1[Raw Title]),Table1[Raw Title]="Mr")>0, "Men", "Women")
and alternatively, you can simply write the following calculated column
NewColumn = if(or([Raw Title]="Mr", [Raw Title]="Heer"), "Men", "Women")
Then a new measure to count Men and Women if needed
Basically, COUNTIF os translated into CALCULATE(COUNT(countable item/column), <condition>)
So, depending on whether you want the calculation as an added column or as a measure, the direct translation will look like
=IF(CALCULATE(COUNT(Table1[Raw Title]),Table1[Raw Title]="Mr")>0, "Men", "Women")
and alternatively, you can simply write the following calculated column
NewColumn = if(or([Raw Title]="Mr", [Raw Title]="Heer"), "Men", "Women")
Then a new measure to count Men and Women if needed
I knew it was simple I was complicating everything for nothing. Thank you so much you just saved me from burnout
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
99 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |