Forum Discussion

nic88's avatar
nic88
Frequent Visitor
3 years ago
Solved

Count of a value

Hi, I'm having an issue with a measure I'm trying to write.

 

I have a table with a partner name as a row and sub rows for different benefits associated with that partner. The column 'plan count' is a measure. I want to add another column 'count of plan benefits' which is the sum of all of the counts for that partner. In the screenshot, I am looking for the 2342 value to be in the green cells. I will then use this after to create a percent weighting. 

 

The current formula for 'count of plan benefits' is:

Count of Plan benefits = CALCULATE(
    COUNT(Benefits[Partner]),
    ALLSELECTED(Benefits[Partner])
)
 
But this isn't doing what I want. 
 
Basically, I want to ignore the individual benefits filter and get the count for the partner which Powerbi sums in yellow and display that in the green cells. 
 

 

 

  • nic88 , Try like

     

    Count of Plan benefits = CALCULATE(
    COUNT(Benefits[Partner]),
    filter( ALLSELECTED(Benefits),Benefits[Partner] = max(Benefits[Partner]))
    )

     

    Or use removefilters for the level having value Risk Advisor etc

     

    Count of Plan benefits = CALCULATE(
    COUNT(Benefits[Partner]),removefilters (Benefits[Level 2]) )

2 Replies

  • nic88 , Try like

     

    Count of Plan benefits = CALCULATE(
    COUNT(Benefits[Partner]),
    filter( ALLSELECTED(Benefits),Benefits[Partner] = max(Benefits[Partner]))
    )

     

    Or use removefilters for the level having value Risk Advisor etc

     

    Count of Plan benefits = CALCULATE(
    COUNT(Benefits[Partner]),removefilters (Benefits[Level 2]) )

    • nic88's avatar
      nic88
      Frequent Visitor

      I used the second solution and it worked! Thank you!