Forum Discussion

alfordtp's avatar
alfordtp
Frequent Visitor
7 years ago
Solved

Filter by parent row total

This seems like a very simple operation, but I'm farily new to DAX/PowerBI so I need some help.

 

I'm showing this in an Excel pivot table, but I'm really using this in Power BI desktop.

 

I have a matrix visualization where I'm looking at which customers use specific kits.  I'm trying to identify which kits are unique to customers.  In my example below, Kits 1,3, and 5 are used by multiple customers and Kit 2 and Kit 4 are only used by one customer each.

 

If I only show the Kits and the Count of Customers, I can filter by when the Count = 1.  But as soon as I add in the customers into the matrix, I can no longer filter by the count being equal to 1 because all of the counts at the customer level are 1.  Do I need to create a distinct count of customers as a variable and then filter on that?  I can do this in an Excel Pivot table, but do not know the syntax in PowerBI.  Thanks in advance.

 

  • Hi alfordtp,

     


    Do I need to create a distinct count of customers as a variable and then filter on that?  

     


    Yes. You could create a measure as below. 

    Measure =
    CALCULATE ( DISTINCTCOUNT ( Table1[Customer] ), ALL ( Table1[Customer] ) )

    Select the Matrix, add this measure to visual level filter and set its value to 1.

    Best regards,

    Yuliana Gu

2 Replies

  • Hi alfordtp

     

    you just need to create a measure where you'd remove the filter coming from customers

     

    CALCULATE( <countrows>, ALL( TableName[Customer] ) )

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi alfordtp,

     


    Do I need to create a distinct count of customers as a variable and then filter on that?  

     


    Yes. You could create a measure as below. 

    Measure =
    CALCULATE ( DISTINCTCOUNT ( Table1[Customer] ), ALL ( Table1[Customer] ) )

    Select the Matrix, add this measure to visual level filter and set its value to 1.

    Best regards,

    Yuliana Gu