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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Problem with DistinctCount/Group BY + filter condition

Hello,

 

I have an issue with a case I have been working on all day 😄

 

I have a table :

 

Title / Item

A / x
A / y

B / x

B / z

C / y
C / z
D / z

 

What I want is to calculate a discount count to have something like this :

A 2

B 2

C 2

D 1

 

I have tried the following measure that is working fine :

 

MeasureCount = SUMX(VALUES(Title),CALCULATE(DISTINCTCOUNT(Item]))

 

But here is the tricky part : I want now to have a visual that only contains :

- MeasureCount > 1

- Item = x

 

So basically :

 

A / 2
B / 2

 

But impossible to do that ==> When I add somewhere a filter on Item = x then the measure is changing and gives = 1 to each row...

 

Any ideas for my problem ?

 

Thanks a lot

 

Romain

4 REPLIES 4
Anonymous
Not applicable

But as soon as I do the filter on item = x then the distinctcount is giving me only 1 for each row... Since there is only x as item...

I didn't get you 

can you please share the screenshot and expected output through pics


✔ Answered? Mark as solution

Muhammad Hasnain | Super User • Fabric • Power BI • Data Engineering

Let's connect on LinkedIn
Anonymous
Not applicable

Indeed it will be better with some screenshots.

 

Initial table :

RomainTo_0-1643372479050.png

 

After the distinctcount group by Title :

 

RomainTo_1-1643372534556.png

 

The final results in the one below : I want to keep only the title that have distinctcount(index)>1 including index = x (so without Title = C that has only index = {y,z}

 

RomainTo_3-1643373044789.png

 

But as soon as I apply the item = x filter, then the distinctcount() returns 1 because PBI is only keeping on the main table the following items :

 

RomainTo_4-1643373144666.png

 

 

I hope this is more clear !

mh2587
Super User
Super User

Just create distinct measure on item like below

count = distinctcount(item) 

and place that measure with tittle


✔ Answered? Mark as solution

Muhammad Hasnain | Super User • Fabric • Power BI • Data Engineering

Let's connect on LinkedIn

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors