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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.