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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
aaronvincentnz
Helper III
Helper III

Distinct count not returning a result

Hello

 

I have the following formula, but not able to return any results.

 

Don't Know =
(CALCULATE(DISTINCTCOUNT(Table[respid]),FILTER('Table', Table[What sort of job?]="Don't know")))
/CALCULATE(DISTINCTCOUNT(Table[respid]))
 
My source data contains 'Good job', 'Bad job' and 'Don't know'. With the same formula above, I'm able to return results for 'Good job' and 'Bad job' (replacing 'Don't know' with either of those) but nothing comes through for 'Don't know'. 
 
Can anyone assist - does it have something to do with the apostrophe within Don't?? 
 
Thanks in advance
1 ACCEPTED SOLUTION

Hi @aaronvincentnz 

I think Don't know in your table may not equal to the string in measure, so the measure couldn't find it.

You could try to copy Don't know from table and try again.

And here I will give you some advice.

If your table is like the following table I built, you can use 100% Stacked bar chart and count(distinct ) function in this visual.

My Table:

2.png

1.png

Or you can update your measure:

 

Measure = 
CALCULATE(DISTINCTCOUNT('Table'[Respid]),FILTER('Table','Table'[What sort of job?]=MAX('Table'[What sort of job?])))

 

Result:

3.png

You can download the pbix file from this link: Distinct count not returning a result

 

Best Regards,

Rico Zhou

 

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

11 REPLIES 11
aaronvincentnz
Helper III
Helper III

Sorry, I got confused with a different post, but this one has been solved with the above solution. 

 

Thanks

 

v-rzhou-msft
Community Support
Community Support

Hi @aaronvincentnz 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

Hi Rico

 

Yes, sorry, it has been solved, by another user. Sorry, I have been on leave so haven't been able to access my messages as frequently.

 

Thanks

 

Hi @aaronvincentnz 

Could you kindly share your workaround or accept the helpful reply as the solution?

More people will benefit from it.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

amitchandak
Super User
Super User

@aaronvincentnz , formula seems correct

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

harshnathani
Community Champion
Community Champion

Hi @aaronvincentnz ,

 

Can you share some sample data and expected output?

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @aaronvincentnz ,

 

If I follow your measure, this is what I get.

 

Let me know if you are looking for something like this, else please share sample data and expected output.

 

1.jpg

 

 

Don't Know = CALCULATE(DISTINCTCOUNT('Table'[respid]),FILTER('Table', 'Table'[What sort of job?]="Don't know"))

 

DCOUNT = DISTINCTCOUNT('Table'[respid])

 

Measure = DIVIDE([Don't Know],[DCOUNT])

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

The formulas all work, but for some reason, nothing comes through in the visualisation...hoping it's not something i've unchecked or filtered out, but here's the output...'don't know' is in the chart, but not displaying...

 

aaronvincentnz_0-1603971329601.png

 

Hi @aaronvincentnz ,

 

Not sure but can you give this a try.

 

Your visualization has Don't_Know ( has an underscore) while your measure does not have an underscore.

 

Let me know if this works, else please share sample data and expected output.

 

Regards,

Harsh Nathani

I was trying various formulas (and was going to keep the correct one once it worked!) hence the underscores etc

 

here's my updated screenshot...still no luck unfortunately

 

aaronvincentnz_0-1603971947146.png

 

Hi @aaronvincentnz 

I think Don't know in your table may not equal to the string in measure, so the measure couldn't find it.

You could try to copy Don't know from table and try again.

And here I will give you some advice.

If your table is like the following table I built, you can use 100% Stacked bar chart and count(distinct ) function in this visual.

My Table:

2.png

1.png

Or you can update your measure:

 

Measure = 
CALCULATE(DISTINCTCOUNT('Table'[Respid]),FILTER('Table','Table'[What sort of job?]=MAX('Table'[What sort of job?])))

 

Result:

3.png

You can download the pbix file from this link: Distinct count not returning a result

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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