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
Anonymous
Not applicable

Count(distinct) and Legend in a visual help

Hi, i was using count distinct for a visual and it was working well

 

I got 99 results

 

DISTINCTCOUNT(row1)

 

BUT 

 

If i add a legend to the visual, now i got 100 results

 

Because the legend =>    in "row2" makes some values in the visual different

 

How can i continue using the DISTINCTCOUNT in row 1 and continue having the same result?

 

(and keep the legend in the visual)

 

Thanks

1 REPLY 1
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

This sounds like a measure totals problem.

See this post about it here:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

For example:

PK Type legend
1 A L1
1 A L2
2 B L3
2 B L3
2 C L3


When there is no legend,

pk=1, distinct(type) is 1(A)

pk=2, distinct(type) is 2(BC)

Now, drag legend into it.

pk=1 has two value,distinct(type) is 1 (L1) and distinct(type) is 1(L2)

pk=2, distinct(type) is 2(L3)

 

So, what is your expected output if legend in the visual.

 

Best Regards,

Lin

 

Community Support Team _ Lin
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.