cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AlexisPREVOT
Helper II
Helper II

Excluding multiple rows with one filter

Hello,

I just created a measure and a slicer that allows me to exclude items that I don't want.
For example :

My initial table :                 

    

AlexisPREVOT_2-1623077822161.png

 

 

My filtered table  if I want to exclude ID Article = 1 :

AlexisPREVOT_1-1623077800416.png

 

 

The DAX Code associated is : 

VAR d =
LOOKUPVALUE('ARTICLE'[ID ARTICLE], 'ARTICLE'[ID ARTICLE], MIN('Table ARTICLE'[ID ARTICLE]))

RETURN
IF (
ISFILTERED (Table ARTICLE'[ID ARTICLE]),
IF ( d IN VALUES ('ARTICLE'[ID ARTICLE]), 1, 0 ),
0
)


But I want to go further by "deleting" the visualization of the table all the companies that have an ID Article = 1

So my end result should be:

AlexisPREVOT_0-1623077778931.png

 

 

Please do you have an idea of ​​the filter that I have to put in place to achieve this result?
Thanks in advance.

 

Alexis 

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @AlexisPREVOT 

 

Why not just create a slicer for the ID field.

If you insist on using a measure, try creating the following measures:

_exclude = 1
_Flag =
IF ( 'Table'[_exclude] = MAX ( 'Table'[ID Article] ), 0, 1 )

Or the whatif parameter will work just as well

_Whatif flag = 
    IF('exclude items'[exclude items Value] = MAX('Table'[ID Article]),0,1)

There are many ways to achieve the result you want, choose the one you like

result:

v-angzheng-msft_0-1623293122613.png

v-angzheng-msft_1-1623293136455.png

Please refer to the attachment below for details

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
AlexisPREVOT
Helper II
Helper II

Hi @v-angzheng-msft ,

 

Sorry for the delay of my response.

Thank you for your solution which fully answered my request.

 

Have a good day.

 

Alexis

 

v-angzheng-msft
Community Support
Community Support

Hi, @AlexisPREVOT 

 

Why not just create a slicer for the ID field.

If you insist on using a measure, try creating the following measures:

_exclude = 1
_Flag =
IF ( 'Table'[_exclude] = MAX ( 'Table'[ID Article] ), 0, 1 )

Or the whatif parameter will work just as well

_Whatif flag = 
    IF('exclude items'[exclude items Value] = MAX('Table'[ID Article]),0,1)

There are many ways to achieve the result you want, choose the one you like

result:

v-angzheng-msft_0-1623293122613.png

v-angzheng-msft_1-1623293136455.png

Please refer to the attachment below for details

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

AlexisPREVOT
Helper II
Helper II

Hi @parry2k ,

 

I just tested and it works if i force the value 'Table'[ID Article] = 1 to a given value.

It is true that I misspoke my request but I would like the "1" to be automaticly replaced by the value of my slicer.

 

It is possible ?

parry2k
Super User III
Super User III

@AlexisPREVOT you have few ways to solve this, one is to add a column in your table and then use this column where value = 0

 

ID to Filter = 
CALCULATE ( COUNTROWS ( 'Table' ), ALLEXCEPT ( 'Table', 'Table'[ID Enterprise] ), 'Table'[ID Article] = 1 ) + 0

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





Hi @parry2k ,

 

Thank you for your answer.

I will try quickly

 

Alexis

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors