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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
abhishekpati86
Helper III
Helper III

Calculate distinct count of the column based on the other values in the column

Capture.JPG

 

Above is the data I am working with on a Matrix Power BI Visualization. I want to add the distict count of the End User Trade Name as another column . So my New column will have the values 1,1,1,5 for the 4 distinct Corporate Account CSN and Corporate Account Name. 

 

When I am using Values part of the Matrix visualization then I am getting subtotals all around and it is becoming messy. Can you please help me with the DAX that calculates the distinct count of the End User Trade Name group by Corporate Account CSN and Corporate Account Name. 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi abhishekpati86,

 

To count the row numbers based on group Corporate Account CSN and Corporate Account Name, please use the following DAX query to create a measure:

CountRow = CALCULATE(DISTINCTCOUNT(Sheet3[End User Trade Name]), ALLEXCEPT(Sheet3,Sheet3[Corporate Account Name],Sheet3[Corporate Account CSN]))

 

If you have any question, please feel free to ask.

 

Best regards,
Yuliana Gu

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

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi abhishekpati86,

 

To count the row numbers based on group Corporate Account CSN and Corporate Account Name, please use the following DAX query to create a measure:

CountRow = CALCULATE(DISTINCTCOUNT(Sheet3[End User Trade Name]), ALLEXCEPT(Sheet3,Sheet3[Corporate Account Name],Sheet3[Corporate Account CSN]))

 

If you have any question, please feel free to ask.

 

Best regards,
Yuliana Gu

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

@abhishekpati86 Why don't you use End User Trade Name column for the Values section of matrix -> click on dropdown icon and select Count(Distinct).

@ankitpatira- I have tried that option but it doesn't work as I have lot of amount columns to the right of the data and it creates lot of subtotal rows on the fly. I think the best option will be to duplicate the table, do a group by to get the count and get the count by merging those 2 tables.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.