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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Cadenze
Regular Visitor

DistinctCount shows 1 when it is 0

I have added a Card to my PowerBI report that shows how many distinct customers are matched, per Reason code. I have 8 lines for 4 customers. so with no filters the card shows 4, which is correct. If I filter on Reason=Material, the card shows 3, which is also correct. And when Reason=Process, the card shows one, which is also correct. If I exclude Material and Process from the filter, the card should show 0, but shows 1. Why??? And more importantly, how do I fix it?

 

Cadenze_1-1695816469398.png

/*CountOfMatched = DISTINCTCOUNT(Table[Customer])+0*/

CountOfMatched for Reason Material = 3 (correct)
CountOfMatched for Process = 1 (correct)
CountOfMatched for none of them = 0 but the visual shows 1

 

2 ACCEPTED SOLUTIONS
v-binbinyu-msft
Community Support
Community Support

Hi @Cadenze ,

Please try to create a measure with below dax formula:

Count of Matched =
IF ( ISFILTERED ( 'Table'[Reason] ), DISTINCTCOUNT ( 'Table'[Customer] ), 0 )

Animation25.gif

Please refer the attached .pbix file

 

Best regards,
Community Support Team_Binbin Yu
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

Cadenze
Regular Visitor

What a cool way to present a solution - thank you! It works 🙂

View solution in original post

3 REPLIES 3
cotswoldclass
New Member

Hi, I had the same issue when I was trying to use the data directly from Salesforce. I was wondering if there is a formula for Salesforce Data in this case? And it's filtered by Company name for example from the data source (Salesforce Reports). Thank you!

Cadenze
Regular Visitor

What a cool way to present a solution - thank you! It works 🙂

v-binbinyu-msft
Community Support
Community Support

Hi @Cadenze ,

Please try to create a measure with below dax formula:

Count of Matched =
IF ( ISFILTERED ( 'Table'[Reason] ), DISTINCTCOUNT ( 'Table'[Customer] ), 0 )

Animation25.gif

Please refer the attached .pbix file

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors