Forum Discussion
COUNTIF formula to PowerBI
- 7 years ago
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