cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
asaemart
Frequent Visitor

Exclude Filter

Hello,

 

We are trying to reproduce the following scenario with no sucess:

 

  • We have imported some data from SQLServer. Specifically one table with 5 columns ("Table1"), being one of them a flag (binary or bit, let's say it is called "flag0/flag1").
  • We have one visualization (table visualization) in which the information of Table1 is showed (except the "flag0/flag1" column).
  • We would like to have another visualization (slicer/check box filter) in which we use the "flag0/flag1" flag column:
    • There is just one box in the slicer ("let's say it is called "flag1") 
    • If the box is not selected, we would like to filter the Table1 for flag0. So as soon as we run the report, the filter is applied.
    • If the box is selected, we would like to filter the Table1 for flag1.

 

Thank you in advance and regards,

 

Adri.

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft
Microsoft

Hi @asaemart,

I try to reproduce your scenario by my sample table below.

1.PNG

I create a new table including flag1 by clicking "New Table" under Modeling on Home page.

2.PNG

Create two measures using the following formula.

ISSELECTED = IF(ISFILTERED(Table3[flag]), VALUES(Table3[flag]),BLANK())

Sales-new = IF(ISBLANK(Table3[ISSELECTED]),CALCULATE(SUM(Table2[sales]),FILTER(Table2,Table2[flag]="flag0")),CALCULATE(SUM(Table2[sales]),FILTER(Table2,Table2[flag]="flag1")))


Create a slicer including flag1, create a table visual shows the information, set the visual filter as the highlighted red line.

3.png

Please see the expected result. I shows the flag in table visual, so that you can see it directly. When we not select "flag1" it display all information for "flag0", otherwise, we select "flag0" it display all information for "flag1".

4.PNG5.PNG

Please download the attachments to test.

Thanks,
Angelia

 

View solution in original post

1 REPLY 1
v-huizhn-msft
Microsoft
Microsoft

Hi @asaemart,

I try to reproduce your scenario by my sample table below.

1.PNG

I create a new table including flag1 by clicking "New Table" under Modeling on Home page.

2.PNG

Create two measures using the following formula.

ISSELECTED = IF(ISFILTERED(Table3[flag]), VALUES(Table3[flag]),BLANK())

Sales-new = IF(ISBLANK(Table3[ISSELECTED]),CALCULATE(SUM(Table2[sales]),FILTER(Table2,Table2[flag]="flag0")),CALCULATE(SUM(Table2[sales]),FILTER(Table2,Table2[flag]="flag1")))


Create a slicer including flag1, create a table visual shows the information, set the visual filter as the highlighted red line.

3.png

Please see the expected result. I shows the flag in table visual, so that you can see it directly. When we not select "flag1" it display all information for "flag0", otherwise, we select "flag0" it display all information for "flag1".

4.PNG5.PNG

Please download the attachments to test.

Thanks,
Angelia

 

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors