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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

DISTINCTCOUNT calculates wrong with filter

Guys!

I'm having some difficulty in the filter context for the DISTINCTCOUNT expression. When I apply a filter to the measurements, it presents incorrect data, but when I use SUM or COUNT, the data is presented correctly. Could anyone tell me why it doesn't work just for DISTINCTCOUNT.

If I add the distinct counts, I don't get the total of 2,523 but rather 2,582. This difference only happens when I use the DISTINCTCOUNT expression. If you look at the second line of data, the sum is correct at 8,070, which I used COUNT.

Capturar.JPG

Download file .pbix:

https://drive.google.com/file/d/1k9jMKQ_EFLTmJOpQAzAQdfAp3ipzgWSN/view?usp=sharing 

1 ACCEPTED SOLUTION
HotChilli
Community Champion
Community Champion

Thanks for the pbix.

Can you explain a bit more about what we need to investigate? I see 2 rows of visuals.  Where is the error or wrong data displayed?

View solution in original post

3 REPLIES 3
HotChilli
Community Champion
Community Champion

There are 2523 distinct values in the whole dataset for COD.  There is overlap of COD in the different Filter categories.

One example is for COD = 106.  There are rows for Filter = LT and rows for Filter = Na e LT.

So these values will be included in the distinctcount for [Total Count LT] and [Total Count NA e LT]

but they will only count as 1 in the [Total].

So the [Total] measure is accurate and the individual distinctcount measures are also accurate but the [Total] will be less

than adding up the individual measures.

HotChilli
Community Champion
Community Champion

Thanks for the pbix.

Can you explain a bit more about what we need to investigate? I see 2 rows of visuals.  Where is the error or wrong data displayed?

Anonymous
Not applicable

If I add the distinct counts, I don't get the total of 2,523 but rather 2,582. This difference only happens when I use the DISTINCTCOUNT expression. If you look at the second line of data, the sum is correct at 8,070, which I used COUNT.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.