Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi Community,
I have a column in my data that has a type of "text" but when I try to do a count or distinct count of the data, it just doesnt work. Can anyone help?
The example is as follows:
Code |
4110 - Uni |
4112 - Coll |
4131 - Store |
4121 - STA |
4110 - Uni |
4110 - Uni |
4110 - Uni |
4121 - STA |
4131 - Store |
4131 - Store |
4121 - STA |
4131 - Store |
4131 - Store |
4121 - STA |
The output should be:
Code | Count |
4110 - Uni | 4 |
4112 - Coll | 1 |
4131 - Store | 5 |
4121 - STA | 4 |
Any help would be greatly appreciated.
TIA
Hi @UK_User123456 ,
Don't know what steps you are following .However when I tried with your example in a table Visual, I get the output as expected:
see screnshot below:
Thanks,
Tejaswi
But would this work if it was referenceing a measure that was calculated?
I have a calculated measure that is based upon a ranking column in my base data, I then wanted to count the number of times those codes appear.
The calculation in my data set is
Hi @UK_User123456 ,
I am now confused and not very much clear with your requirements.
Your first post says you want the count of codes, but now it says it is based on different data.
Could you be more specific or provide some sample data?
With your sample data and specific requirements it would be easy for us to resolve your issues ASAP.
Thanks,
Tejaswi
As with my previous post, I have created a column within my data table set that gives me the ranking of the code by the date as follows:
ID | Date | Code | Power Bi Measure Ranking | |
1 | 03/01/2017 | 4110 - Uni | 1 | |
1 | 02/01/2017 | 4110 - Uni | 1 | |
2 | 01/05/2019 | 4112 - Coll | 1 | |
3 | 02/02/2018 | 4131 - Store | 1 | |
4 | 01/06/2018 | 4121 - STA | 1 | |
1 | 12/01/2017 | 4110 - Uni | 2 | |
1 | 15/07/2018 | 4110 - Uni | 3 | |
1 | 21/02/2019 | 4110 - Uni | 4 | |
4 | 12/08/2018 | 4121 - STA | 2 | |
3 | 12/02/2019 | 4131 - Store | 2 | |
3 | 15/05/2019 | 4131 - Store | 3 | |
4 | 13/02/2019 | 4121 - STA | 3 | |
4 | 02/06/2018 | 4121 - STA | 1 | |
3 | 17/06/2019 | 4131 - Store | 4 | |
3 | 30/06/2019 | 4131 - Store | 5 | |
4 | 16/07/2019 | 4121 - STA | 4 | |
2 | 01/07/2019 | 4112 - Coll | 2 |
Potential final output based on ranking 1:
Code | Count of Code |
4110 - Uni | 2 |
4112 - Coll | 1 |
4131 - Store | 1 |
4121 - STA | 3 |
I am now thinking that this cannot be done based on creating a ranking column in my dataset.
TIA
Hi @UK_User123456 ,
Have you got the column of Power Bi Measure Ranking using the formula of ID Rank (ASC)? If so, you can create a measure to count code.
Measure = CALCULATE(COUNT('table 1'[Code]),FILTER('table 1','table 1'[ID Rank (ASC)] = 1))
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The following measures should give you the counts you are looking for
Count = CountRows('table')
Distinct Count = DISTINCTCOUNT('table'[column])
I hope this helps,
Richard
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |