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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Filter + Anti Filter for a page

Hi All, 

 

Im looking to create a global filtering system that will allow me to filter certain products and NOT others. For example:

 

I have a list of accounts and products they have purchased. I want to be able to have two product filters; the first would filter all accounts who HAVE purchased said product (simple enough), but the second would filter that same list, but only show those who met the first criteria and do NOT have the second product filtered. here's an example with data 

 

AccountProduct
A1
B2
C2
D3
D4
D2
B3
C1

 

Filter 1 : Product 1, Would only show Account A and C

Filter 2: Product 2. Since Account C does have Product 2 and Product 1, only show Account A

 

Thanks for any and all help!

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

use this measure

filter1measure = 
var _sel=SELECTEDVALUE(Table2[Product])
return IF(ISBLANK(_sel),1,IF(MIN('Table'[Product])=_sel,1,0))
filter2measure = 
var _sel=SELECTEDVALUE(Table3[Product])
var _Account=SELECTEDVALUE('Table'[Account])
var _countAccount1=CALCULATE(COUNT('Table'[Account]),FILTER(ALL('Table'),'Table'[Product]=_sel&&'Table'[Account]=_Account))
var _countAccountAll=CALCULATE(COUNT('Table'[Account]),FILTER(ALL('Table'),'Table'[Account]=_Account))
return IF(ISBLANK(_sel),1,IF(MIN('Table'[Product])=_sel&&_countAccount1=_countAccountAll,1,0))

vxiaotang_2-1626763079968.png

 

result

vxiaotang_0-1626762858463.png vxiaotang_1-1626762875835.png

---

if problem still persists, please let me know.  (please @ my ID, so that I won't miss the message.)

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

use this measure

filter1measure = 
var _sel=SELECTEDVALUE(Table2[Product])
return IF(ISBLANK(_sel),1,IF(MIN('Table'[Product])=_sel,1,0))
filter2measure = 
var _sel=SELECTEDVALUE(Table3[Product])
var _Account=SELECTEDVALUE('Table'[Account])
var _countAccount1=CALCULATE(COUNT('Table'[Account]),FILTER(ALL('Table'),'Table'[Product]=_sel&&'Table'[Account]=_Account))
var _countAccountAll=CALCULATE(COUNT('Table'[Account]),FILTER(ALL('Table'),'Table'[Account]=_Account))
return IF(ISBLANK(_sel),1,IF(MIN('Table'[Product])=_sel&&_countAccount1=_countAccountAll,1,0))

vxiaotang_2-1626763079968.png

 

result

vxiaotang_0-1626762858463.png vxiaotang_1-1626762875835.png

---

if problem still persists, please let me know.  (please @ my ID, so that I won't miss the message.)

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Have you solved your problem? If yes, kindly accept the answer helpful as the solution. so the others can find it more quickly.

Or

if problem still persists, please let me know.

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , the second slicer need to be on an independent table 

 

Try measure like this for second  


measure =

var _table = summarize(filter(Table, Table[Product] in selectedvalue(product2[product])), Table[Account])
return
calculate(count(Table[Product]), filter(Table, not(Table[Account] in _table)))

 

Anonymous
Not applicable

@amitchandak , I tried this measure and am using a separate table for filtering, but the Measure is just returning a count....Would i then filter on Measure = 0?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.