Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
linoe
Frequent Visitor

Distinct count of string column by max value of number column

I found some threads that sounded similar but were a lot more complex, and this seems like it should be straight forward but I'm just not getting it. I have a table with just two columns, Title and Status. Status is a number (0,1,2),and Title has duplicates. I'm trying to get the distinct count of titles grouped by the max value of status. I've created a measure to get the Max for each Title, and that seems to work, but when I try to get the count for each max I just end up with a total count for the value of 2, not for each individual value. In the end, I'm looking for the results to be 1,2,3 for the max values of 0,1,2 respectively.

 

TitleStatus Max
Task 10 1
Task 11 1
Task 31 1
Task 42 2
Task 51 2
Task 52 2
Task 81 2
Task 80 2
Task 90 0
Task 82 2
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

You may download my PBI file from here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

 

You may download my PBI file from here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Geez, I dont know how I didn't think to just group in the query editor, I've done it for other things but for some reason here I was trying to do it all on the report side. This was so simple.

v-danhe-msft
Employee
Employee

Hi @linoe,

Due to I could not achieve your measure of [Max] column, I have used a sample data to replace, you could refer to below formula to count the value of [Max]:

Measure = CALCULATE(COUNT(Table1[Max]),ALLEXCEPT(Table1,Table1[Max]))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.