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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
patilpoonam21
Helper I
Helper I

Show only Selected columns based on Disconnected slicer

Hi,

 

I have below table, 

PersonQ1 AttQ2 AttQ3 AttQ4 Att
A10163232
B11121212
C12133243
D1316323
E14234343
F15434334
G1623434
H17421123
I1843432

 

Also, below disconnected slicer created:
I need to create a Table visual, if I select value, "Q1 & Q2" from the below slicer, it should display only "Q1 Att" and "Q2 Att" columns from the above table. Can anyone help on that? I am using Power BI Desktop 2019 version,

Thanks in advance!

 

Quarters
Q1 & Q2
Q2 & Q3
Q3 & Q4
2 ACCEPTED SOLUTIONS
Daniel29195
Super User
Super User

@patilpoonam21 

create the following table : 

Quarters | KEY
Q1 & Q2 |Q1
Q1 & Q2 | Q2
Q2 & Q3|  Q2
Q2 & Q3  | Q3
Q3 & Q4 | Q3
Q3 & Q4 | Q4

 

Daniel29195_0-1706570445606.png

 

 

 

UNPIVOT THE ABOVE THE TABLE with poewr query  

steps : 

step1 :  select the column person

step2 :  go to transform --> unpivot other columns (  near unpivot, there is a down arrow . click on it and select unpivot other columns ) ,

 

now you will have a table as below : 

 

 

 

next step, 

use rreplace values from power query and replace  : " Att" with blank 

Daniel29195_2-1706570691513.png

 

 

almost there.....

 

 

now click close and apply.

 

 

create a link between the 2 tables on key -- attribute,

Daniel29195_3-1706570823216.png

 

 

you are good to go .

Daniel29195_4-1706570845897.png

 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

View solution in original post

v-weiyan1-msft
Community Support
Community Support

Hi @patilpoonam21 ,

 

Based on your description,
I created some data:
Table:

vweiyan1msft_0-1706596446024.png

Table 2:

vweiyan1msft_1-1706596457574.png

Please try the following code to create Measure.

Q1 Measure = 
IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q1" ),
    SUM ( 'Table'[Q1 Att] ),
    BLANK ()
)
Q2 Measure = 
IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q2" ),
    SUM ( 'Table'[Q2 Att] ),
    BLANK ()
)
Q3 Measure = 
IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q3" ),
    SUM ( 'Table'[Q3 Att] ),
    BLANK ()
)
Q4 Measure = 
IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q4" ),
    SUM ( 'Table'[Q4 Att] ),
    BLANK ()
)
Measure 1 = 
VAR _sel = SELECTEDVALUE('Table 2'[Quarters], "All")
RETURN
SWITCH(
    _sel,
    "Q1 & Q2",[Q1 Measure],
    "Q2 & Q3",[Q2 Measure],
    "Q3 & Q4",[Q3 Measure]
)
Measure 2 = 
VAR _sel = SELECTEDVALUE('Table 2'[Quarters], "All")
RETURN
SWITCH(
    _sel,
    "Q1 & Q2",[Q2 Measure],
    "Q2 & Q3",[Q3 Measure],
    "Q3 & Q4",[Q4 Measure]
)

The field of the slicer is from Table 2. When you select "Q1 & Q2" in the slicer, Result is as below.

vweiyan1msft_2-1706596713651.png

 

Best Regards,
Yulia Yan

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
v-weiyan1-msft
Community Support
Community Support

Hi @patilpoonam21 ,

 

Based on your description,
I created some data:
Table:

vweiyan1msft_0-1706596446024.png

Table 2:

vweiyan1msft_1-1706596457574.png

Please try the following code to create Measure.

Q1 Measure = 
IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q1" ),
    SUM ( 'Table'[Q1 Att] ),
    BLANK ()
)
Q2 Measure = 
IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q2" ),
    SUM ( 'Table'[Q2 Att] ),
    BLANK ()
)
Q3 Measure = 
IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q3" ),
    SUM ( 'Table'[Q3 Att] ),
    BLANK ()
)
Q4 Measure = 
IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q4" ),
    SUM ( 'Table'[Q4 Att] ),
    BLANK ()
)
Measure 1 = 
VAR _sel = SELECTEDVALUE('Table 2'[Quarters], "All")
RETURN
SWITCH(
    _sel,
    "Q1 & Q2",[Q1 Measure],
    "Q2 & Q3",[Q2 Measure],
    "Q3 & Q4",[Q3 Measure]
)
Measure 2 = 
VAR _sel = SELECTEDVALUE('Table 2'[Quarters], "All")
RETURN
SWITCH(
    _sel,
    "Q1 & Q2",[Q2 Measure],
    "Q2 & Q3",[Q3 Measure],
    "Q3 & Q4",[Q4 Measure]
)

The field of the slicer is from Table 2. When you select "Q1 & Q2" in the slicer, Result is as below.

vweiyan1msft_2-1706596713651.png

 

Best Regards,
Yulia Yan

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

Daniel29195
Super User
Super User

@patilpoonam21 

create the following table : 

Quarters | KEY
Q1 & Q2 |Q1
Q1 & Q2 | Q2
Q2 & Q3|  Q2
Q2 & Q3  | Q3
Q3 & Q4 | Q3
Q3 & Q4 | Q4

 

Daniel29195_0-1706570445606.png

 

 

 

UNPIVOT THE ABOVE THE TABLE with poewr query  

steps : 

step1 :  select the column person

step2 :  go to transform --> unpivot other columns (  near unpivot, there is a down arrow . click on it and select unpivot other columns ) ,

 

now you will have a table as below : 

 

 

 

next step, 

use rreplace values from power query and replace  : " Att" with blank 

Daniel29195_2-1706570691513.png

 

 

almost there.....

 

 

now click close and apply.

 

 

create a link between the 2 tables on key -- attribute,

Daniel29195_3-1706570823216.png

 

 

you are good to go .

Daniel29195_4-1706570845897.png

 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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