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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
menik_sun
Regular Visitor

Distinct count excluding blank rows in a matrix

Chart is like below

Contract TypeNosDesignationLocation
Permanent1Manager 1London
Permanent1Manager 1Paris
Permanent1Manager 1New York
Permanent2Manager 1Brussels
Permanent2Manager 1Amsterdam
Permanent3Worker 1Washington DC
Permanent3Worker 1London
Permanent3Worker 1Paris
Permanent3Worker 1Brussels
Contract Worker 2Amsterdam
Contract Worker 3New York
Contract Worker 4London
Contract Worker 5New York
Contract Worker 5Washington DC

 

First Formula Required: Count of Nos
Distinct Count of No excluding Blanks
for above chart, outcome should be 3 (unique count of 1, 2 & 3)

Second Formula Required: Count of Designation
Distint Count of Designation
for above chart, outcome should be 6

 

At the end, if I can get a table like below, it would be of great help:

 

Contract TypeCount of NosCount of Designation
Permanent32
Contract44
Total76
3 REPLIES 3
Anonymous
Not applicable

Hi @menik_sun ,

 

Please try the following measures:

 

first formula - COUNTROWS(SUMMARIZE(Table, Table[ContractType], Table[Desgination], Table[Nos]))

second formula - COUNTROWS(SUMMARIZE(Table, Table[ContractType], Table[Designation]))

 

I arrived at the following matrix using ContractType in Rows.

sktoh86_0-1620358017621.png

 

Cheers

 

amitchandak
Super User
Super User

@menik_sun , You can try measure like

 

three examples

 

calculate(distinctcount(Table[Nos]), filter(Table, not(isblank([Nos]))))

 

calculate(distinctcount(Table[Designation]), filter(Table, not(isblank([Nos]))))

 

calculate(distinctcount(Table[Designation]), filter(Table, not(isblank([Designation]))))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for your reply @amitchandak . It's showing correct total but not while using field dimension. It is showing total result even after using field as rows.

 

Below is what I get after using the formula:

 

Thanks for your reply @amitchandak . It's showing correct total but not while using field dimension. It is showing total result even after using field as rows.

 

Below is what I get after using the formula:


                              With suggested formula         Formula required for
Contract Type             Count of Nos                     Count of Nos
Permanent                           7                                          3
Contract                              7                                          4
Total                                    7                                          7

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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