Forum Discussion

patilpoonam21's avatar
2 years ago
Solved

Show only Selected columns based on Disconnected slicer

Hi,   I have below table,  Person Q1 Att Q2 Att Q3 Att Q4 Att A 10 16 32 32 B 11 12 12 12 C 12 13 32 43 D 13 16 3 23 E 14 23 43 43 F 15 43 43 34 ...
  • Daniel29195's avatar
    2 years ago

    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

     

     

     

     

    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 

     

     

    almost there.....

     

     

    now click close and apply.

     

     

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

     

     

    you are good to go .

     

     

     

     

    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! 🤠

  • v-weiyan1-msft's avatar
    2 years ago

    Hi patilpoonam21 ,

     

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

    Table 2:

    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.

     

    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.