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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AlexisPREVOT
Helper III
Helper III

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 III
Helper III

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.

AlexisPREVOT
Helper III
Helper III

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
Super User

@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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors