Forum Discussion
DAX function to count specific text values from a column
- 10 years ago
You need to write a formula like which will count all the rows containing "This Value"
CountValues = CALCULATE ( COUNTROWS ( TableName ); TableName[ColumnName] = " This Value " )
Hi karthik
thanks for your comments. I was reading, but in case I need count how often all the rows repeat (of course I can't specificate the world) For example:
Table:
Jim
Tom
Tom
Mary
Jim
Jim
I would like to Return:
Jim 3
Tom 2
Tom 2
Mary 1
Jim 3
Jim 3
Thanks you very much!
I found a workaround to the issue in trying to replicate the countif functionality of excel
I had a file like this:
| Date | Project |
| 1/08/2017 | XYZ |
| 2/08/2017 | XYZ |
| 3/08/2017 | XYZ |
| 4/08/2017 | XYZ |
| 5/08/2017 | XYZ |
| 6/08/2017 | XYZ |
| 1/09/2017 | ABC |
| 2/09/2017 | ABC |
| 3/09/2017 | ABC |
| 4/09/2017 | ABC |
| 5/09/2017 | ABC |
| 6/09/2017 | ABC |
| 12/10/2017 | DEF |
| 13/10/2017 | DEF |
| 11/11/2017 | IJK |
Step 1 : Duplicate the table in power BI as separate table
Step 2 : "Group By" on "Projects" field by "count rows", this will summarize the table
Step 3 : Using the "Lookup" function in the original table, crreate a calculated column, there you go you'll have your field in power BI
Hope this helps.
- samihuq8 years agoHelper III
Thats Really annoying, in excel its farely easy using countif functions, does any one has a solution yet!!!