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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
DK-C-87
Helper I
Helper I

Count only once per ID group

Have can I get this measure to only count Plant once ?

Highlighted butikker = COUNTX(HighlightGBS, IF([Highlight Valgte Muligheder] > 0, 1))-0

Currently it gives me 14, but it should give me 13 because plant 1483 has two subdivisions present with a 1 each

DKC87_0-1728453760169.png

 

The "Hightlight Valgte Muligheder" measure looks like this:

Highlight Valgte Muligheder = 
VAR Valgte = IF(ISCROSSFILTERED('Highlight indhold'[Valgmuligheder]), COUNTA('Highlight indhold'[Valgmuligheder]), 0) -- currently not been used
VAR Opslag = VALUES('Highlight indhold'[Valgmuligheder])
VAR Business_Cases = IF(CONTAINS(Opslag, 'Highlight indhold'[Valgmuligheder], MAX(HighlightGBS[HL - Business Cases])), 1, 0)
VAR Storbageri = IF(CONTAINS(Opslag, 'Highlight indhold'[Valgmuligheder], MAX(HighlightGBS[HL - Storbageri])), 1, 0)
VAR Bageri = IF(CONTAINS(Opslag, 'Highlight indhold'[Valgmuligheder], MAX(HighlightGBS[HL - Bageri])), 1, 0)
VAR Egen_Ren = IF(CONTAINS(Opslag, 'Highlight indhold'[Valgmuligheder], MAX(HighlightGBS[HL - Egen Rengøring])), 1, 0)
VAR Resultat = Business_Cases + Storbageri + Bageri + Egen_Ren
VAR MultiResultat = IF(Resultat > 1 && CALCULATE(DISTINCTCOUNT(HighlightGBS[Plant]), HighlightGBS[Helper] > 1), 1, 0)

RETURN
IF(HASONEFILTER('Highlight indhold'[Valgmuligheder]),Resultat,
IF(ISCROSSFILTERED('Highlight indhold'[Valgmuligheder]), MultiResultat, BLANK()))

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @DK-C-87  you can modify the measure:

 

Highlighted butikker =
CALCULATE(
COUNTROWS(
DISTINCT(HighlightGBS[Plant])
),
FILTER(HighlightGBS, [Highlight Valgte Muligheder] > 0)
)

 

I hope by using DISTINCT, the count for Plant 1483 will only appear once, giving you the correct result of 13 instead of 14.

 

Please check.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @DK-C-87  you can modify the measure:

 

Highlighted butikker =
CALCULATE(
COUNTROWS(
DISTINCT(HighlightGBS[Plant])
),
FILTER(HighlightGBS, [Highlight Valgte Muligheder] > 0)
)

 

I hope by using DISTINCT, the count for Plant 1483 will only appear once, giving you the correct result of 13 instead of 14.

 

Please check.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors