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
Companyuser101
Helper II
Helper II

filter with and

Hello, 

 

for the slicer in power bi is an "and" operator possible?

 

So when you select two possibilities on a slicer its always one OR the other. 

Is it possible for a slicer thats its the one AND the other. 

 

Companyuser101_0-1714670609668.png

 

so for example when I select "FÖSTEN KG" and "GERATECH" I only receive the items with both criterias 

 

Thanks in advance. 

 

 

 

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

Hi, @Companyuser101 

First, you can turn on the multi-select feature of Slicer:

Slicer setting>>Seletion>>Muti_seleted

vjianpengmsft_0-1714699259300.png

In addition, you can use the following DAX to calculate items that belong to the slicer selection:

sales amount = 
VAR _silceritem = SELECTCOLUMNS('Table',"product",'Table'[Product])
RETURN 
CALCULATE(SUM('Table'[sales]),FILTER('Table','Table'[Product] IN _silceritem))

This DAX expression mainly uses the seletcolumns function to return the items selected by the slicer, and then uses the IN function to determine whether the current field is in the items selected by the slicer, and if so, then calculate the sales.

SELECTCOLUMNS function (DAX) - DAX | Microsoft Learn

The IN operator in DAX - SQLBI

SELECTCOLUMNS – DAX Guide - SQLBI

I've provided the PBIX file used this time below.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Share a dummy dataset and for that dataset, show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-jianpeng-msft
Community Support
Community Support

Hi, @Companyuser101 

First, you can turn on the multi-select feature of Slicer:

Slicer setting>>Seletion>>Muti_seleted

vjianpengmsft_0-1714699259300.png

In addition, you can use the following DAX to calculate items that belong to the slicer selection:

sales amount = 
VAR _silceritem = SELECTCOLUMNS('Table',"product",'Table'[Product])
RETURN 
CALCULATE(SUM('Table'[sales]),FILTER('Table','Table'[Product] IN _silceritem))

This DAX expression mainly uses the seletcolumns function to return the items selected by the slicer, and then uses the IN function to determine whether the current field is in the items selected by the slicer, and if so, then calculate the sales.

SELECTCOLUMNS function (DAX) - DAX | Microsoft Learn

The IN operator in DAX - SQLBI

SELECTCOLUMNS – DAX Guide - SQLBI

I've provided the PBIX file used this time below.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

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.