Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
hello,
What is the PowerBI counterpart of =COUNTIF, please?
in my excel file, I am using =IF(COUNTIF([@Tags],"*mango*"), "yes","no")to pick out the word 'mango' and of they are present mark them as 'yes', else 'no'.
Thanks in advance.
Solved! Go to Solution.
That formula is for a measure, if you're creating a column with DAX you can leave out the MAX portion of that!
Hi @Mee2105 ,
As far as I know, your code should mean that if data in [@Tags] contains "mango" then return "yes" else return "no".
You can try code as below to create a calculated column.
Column = IF(CONTAINSSTRING('Table'[Tags],"mango"),"yes","no")
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Mee2105 ,
As far as I know, your code should mean that if data in [@Tags] contains "mango" then return "yes" else return "no".
You can try code as below to create a calculated column.
Column = IF(CONTAINSSTRING('Table'[Tags],"mango"),"yes","no")
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much, this works
If you're just trying to count mangos, you can use calculate.
Mango Count = CALCULATE(COUNT('Table'[id]),'Table'[Tags] = "mango")
Calculate is a filter function that uses your second argument (in this case, 'Table' [Tags]="mango") to filter your first argument.
If you are trying to mark them yes/no, we could do that too it just depends on what you're looking for.
Also, why isnt it accepting =CALCULATE as a formula?
You need to put a name.
Thank you for the solution.
is there a way to mark them as 'yes' and 'no' in another column?
Yes. It would look like
is Mango = IF(MAX('Table'[Tag])="mango","Yes","No")
That formula is for a measure, if you're creating a column with DAX you can leave out the MAX portion of that!
User | Count |
---|---|
98 | |
89 | |
82 | |
70 | |
67 |
User | Count |
---|---|
114 | |
104 | |
101 | |
72 | |
65 |