Forum Discussion

WDarwish's avatar
WDarwish
Frequent Visitor
6 years ago
Solved

Help with counting behavior

Apologies if the subject is not 100% clear - it is difficult to describe as English is not my native language.

 

I have a simplified data set that represents my problem. Also attached sample PBIX.

Sample PBIX

 

Source IDRow IDValueIs Visible?
AA10False
AA20True
AB3True
BC4True
BC7False
BD1True
BD6False
BD11False

 

I want to create the following behavior in Power BI:

  • Display ONLY visible items in a table (achieved with visual-level filter)
  • Display a card visual containing the number of invisible items
  • When clicking on a row in the table, have the card visual update to the number of invisible items from the same Source ID and Row ID

 

So opening the Power BI with no selections would give count of invisible = 4. But clicking on first row (A, A), counter should update to 1 (in attached it goes BLANK). Clicking on row (A,B) should give 0. Row (B, C) should give 1. Row (B,D) should give 2.

 

I am trying to build this in, but no matter what I try, cross-filtering gives BLANK in the counter. For example, in below screenshot, I want it to give 2.

 

This is an oversimplified example, so the solution will be retrofitted into the original report.

 

Please help? Thanks.

  • WDarwish for card, add this following measure and you don't need visual level filter on card whcih you currently have.

     

    Invisible Count = 
    CALCULATE( COUNTROWS( 'Sample' ), NOT 'Sample'[Is Visible?] )  
  • parry2k's avatar
    parry2k
    6 years ago

    WDarwish Basically that measure is saying just ignore any filter on Is Visible  and just count where Is Visible is False

3 Replies

  • WDarwish for card, add this following measure and you don't need visual level filter on card whcih you currently have.

     

    Invisible Count = 
    CALCULATE( COUNTROWS( 'Sample' ), NOT 'Sample'[Is Visible?] )  
    • WDarwish's avatar
      WDarwish
      Frequent Visitor

      Is it really this simple? Are you a magician? :D

       

      Seriously though, do you mind explaining the logic of how it works? I understand the individual functions used in the measure, but I do not understand how they combine to filter out data and count only rows of concern.

      • parry2k's avatar
        parry2k
        Super User

        WDarwish Basically that measure is saying just ignore any filter on Is Visible  and just count where Is Visible is False