Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Help Needed with Power BI Measure to Count Unique Key Controls

 I am working on a Power BI report where I need to count the number of unique key controls. I have two tables: ControlRelations and DimControl.

 

The ControlRelations table contains multiple instances of controls (since it also lists out relations with other dimensions), there is a column called IsKeyControl and it's either True or False. I would like to create a measure that is similar to this:

TotalKeyControls =
CALCULATE(
    COUNTROWS('Historical Controls'),
    'Historical Controls'[IsKeyControl] = TRUE()
)

However, since there are multiple instances of the same control (denoted by the same Guid), it counts 1 key control as 1,2,3,4.....etc. Each control will have the same value for IsKeyControl. So for any Guid = Guid, IsKeyControl = IsKeyControl.

What I am looking for is a measure that will count the number of keycontrols and only count 1 key control per unique Guid. 

Can someone help me out please? Copilot has been of no use to me.

Kind regards

 

  • Anonymous Use DISTINCTCOUNT or COUNTROWS( DISTINCT( SELECTCOLUMS( ... ) ) )

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous Use DISTINCTCOUNT or COUNTROWS( DISTINCT( SELECTCOLUMS( ... ) ) )