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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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