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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
catfood49
Frequent Visitor

Measure for Inverse of Filter?

I am analysing Contacts who have visited certain Pages (Touchpoints) in a website. Of all the pages of the site, I have 3 that I want to analyse in a filter. These 3 pages are in a separate table. From the Filter of pages I want to create the following measures:

 

  1. Contacts who have visited pages selected by the Filter
  2. Contacts who have visited pages NOT selected by the filter

The table structure is straightforward:

 

Filter Touchpoint.PNG

 

I have managed to create the Measure 'Visited Selected' which is correctly showing contacts who have Events for the selected filters (A) & (C) as shown below, however I can't seem to get the Measure for 'Visited Non-Selected' working.

 

filter image.PNG

 

 

The code I have written for the measure to count contacts who have visited '(B) Player' is below however it is returning 0:

 

Visited Non-Selected = 

var selected = values( '_Filter Touchpoint'[Touchpoint] )
var allTouchpoint = all( '_Filter Touchpoint'[Touchpoint] )
var notSelected = EXCEPT( allTouchpoint , selected )

var distinctContact = GROUPBY(
        ADDCOLUMNS(
                filter(
                        GROUPBY(  
                                Event               
                                , Event[Contact Key]
                                , Event[Touchpoint Key]                                
                        )
                        , Event[Touchpoint Key] in notSelected
                )
                , "Event Count" , 1
        )
        , Event[Contact Key]
        , "Total Events" , SUMX( CURRENTGROUP() , [Event Count] )
)

return if( SUMX( distinctContact , [Total Events] ) = [Filter Count] , SUMX( distinctContact , [Total Events] ) , 0 )

Either this code needs some tweaking or a need a very different approach. Can anyone help?

 

Thanks

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

Take a look at my Inverse Aggregator Quick Measure here:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Inverse-Aggregator/m-p/342266

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.