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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Hassan_346
Regular Visitor

Comparison visuals using a single slicer.

Hi,


I have a comparison report that is currently fetching data from two tables named "Sheet 1" and "Sheet 2." The report is divided into two parts, each with a slicer from a different column of the respective table.

Sheet 1 

LinkInstituteType
1OpenLine
2CloseCircle
3RightOval
4LeftLine
5StraightCircle
6BackOval

 

Hassan_346_0-1689986696468.png

the other table has the following data:

Sheet 2

Name LinkDrink(1 or 0)
H R11
A R20
N R31
M R40
C R51
Q R 60
T R F R 61
Y R50
L K 40
N R30
M R21


The dashboard is as follows:

Hassan_346_1-1689988136042.png

I want to remove the type slicer and have only the institute slicer. Therefore, when an institute value is selected, the corresponding type value should be automatically chosen. However, the sum of drinks for the identified type should consider all types in Sheet2, not just the selected institute.

Hassan_346_2-1689988595012.png


The following measure was used to calculate the sum:


Test =
VAR SelectedInstitute = SELECTEDVALUE('Sheet2'[Institute])
VAR AffiliatedLinks =
    CALCULATETABLE(
        VALUES('Sheet2'[Link]),
        'Sheet2'[Institute] = SelectedInstitute
    )
RETURN
    CALCULATE(
        SUM('Sheet1'[Drink(1 or 0)]),
        'Sheet1'[Link] IN AffiliatedLinks
    )



When I restore the secondary slicer, the visuals start working perfectly fine.

Is there a method for the primary slicer to be the only slicer, with the visuals working fine with them? 

Thanks in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Hassan_346 ,

You can follow the steps below to get it, please check if that is what you want.

1. Do not create any relationship between 'Sheet1' and 'Sheet2'

vyiruanmsft_0-1690249951432.png

2. Create a measure as below

Sum of drink = 
VAR _selinstitutes =
    ALLSELECTED ( 'Sheet1'[Institute] )
VAR _types =
    CALCULATETABLE (
        VALUES ( 'Sheet1'[Type] ),
        FILTER ( 'Sheet1', 'Sheet1'[Institute] IN _selinstitutes )
    )
VAR _links =
    CALCULATETABLE (
        VALUES ( 'Sheet1'[Link] ),
        FILTER ( ALL ( 'Sheet1' ), 'Sheet1'[Type] IN _types )
    )
RETURN
    CALCULATE (
        SUM ( 'Sheet2'[Drink(1 or 0)] ),
        FILTER ( 'Sheet2', 'Sheet2'[Link] IN _links )
    )

vyiruanmsft_1-1690249989143.png

Best Regards

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Hassan_346 ,

According to your description, it seems that the returned result is not correct when apply the slicer(s). Are the fields which applied on the slicers from different tables or the same table? If they are from different tables, is there any relationship created between the tables? Could you please provide more raw data in your tables (exclude sensitive data) with Text format, the created visuals and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Hi,

Thanks for the advise. I updated the question. 

Anonymous
Not applicable

Hi @Hassan_346 ,

I created a sample pbix file, please find the details in the attachment.

Create relationshipCreate relationship

Create slicerCreate slicer

Best Regards

Hi @Anonymous ,

Thanks for the response. I can't access the file. However, I did create a relationship between the two tables using links. but the sum of drink for Circle still comes to 1, while it should be 2. 

Anonymous
Not applicable

Hi @Hassan_346 ,

You can follow the steps below to get it, please check if that is what you want.

1. Do not create any relationship between 'Sheet1' and 'Sheet2'

vyiruanmsft_0-1690249951432.png

2. Create a measure as below

Sum of drink = 
VAR _selinstitutes =
    ALLSELECTED ( 'Sheet1'[Institute] )
VAR _types =
    CALCULATETABLE (
        VALUES ( 'Sheet1'[Type] ),
        FILTER ( 'Sheet1', 'Sheet1'[Institute] IN _selinstitutes )
    )
VAR _links =
    CALCULATETABLE (
        VALUES ( 'Sheet1'[Link] ),
        FILTER ( ALL ( 'Sheet1' ), 'Sheet1'[Type] IN _types )
    )
RETURN
    CALCULATE (
        SUM ( 'Sheet2'[Drink(1 or 0)] ),
        FILTER ( 'Sheet2', 'Sheet2'[Link] IN _links )
    )

vyiruanmsft_1-1690249989143.png

Best Regards

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors