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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Value and Distinct function giving same result

I am using two tables "Category" and "Product"

vimina_vinod_0-1612351444763.png

vimina_vinod_1-1612351506235.png

Below is the output which I am getting:

vimina_vinod_2-1612351633574.png

Ideally Distinct function should calculate the value excluding the blank. But here Value and Distinct is giving me the same result. 

Here is the definition which I used:

Products DISTINCT = COUNTROWS(DISTINCT('Product'[Product]))
Products VAL = COUNTROWS(VALUES('Product'[Product]))
1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Modify measure Products DISTINCT as below:

Products DISTINCT = IF(MAX('Product'[Category]) in FILTERS(Category[category Id]),CALCULATE(DISTINCTCOUNT('Product'[Product])),BLANK())

And you will see:

1.png 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Modify measure Products DISTINCT as below:

Products DISTINCT = IF(MAX('Product'[Category]) in FILTERS(Category[category Id]),CALCULATE(DISTINCTCOUNT('Product'[Product])),BLANK())

And you will see:

1.png 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Tahreem24
Super User
Super User

@Anonymous ,

It works perfect. As you dont have blank records in your Product column. If you count for Category so it may give you right result because you have blank records in Category.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
amitchandak
Super User
Super User

@Anonymous , You are getting blank because your category table does not have all categories. The calculation is correct

 

you can also try

Products DISTINCT = DISTINCTCOUNT('Product'[Product])

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors