Forum Discussion

gauravnarchal's avatar
gauravnarchal
Post Prodigy
5 years ago
Solved

Need help - Change table visual based on value in slicer

Hello -  How can I change the visual in the table based on the selection?

 

For eg:-

 

If I select client ABC (In SLicer), I want the table visual to show remark 1, remark 2, remark 3 along with the columns in green

 

and if I selected client XYZ (In SLicer) I want to show remark 5, remark 8, remark 9 along with the columns in green

 

Data

 

InvoiceDateClientNameInvoiceNumberInvoiceIDRemark 1Remark 2Remark 3Remark 5Remark 8Remark 9
8/17/2021 0:00ABC817064926099123ABC
8/17/2021 0:00ABC817065926101456ABC
8/17/2021 0:00ABC817068926105789ABC
8/17/2021 0:00ABC817069926107101112ABC
8/17/2021 0:00XYZ817071926169131415131415
8/17/2021 0:00XYZ817077926112131415202122
8/17/2021 0:00XYZ817078926114131415232425
8/17/2021 0:00XYZ817087926134131415262728
8/17/2021 0:00XYZ817088926136131415293031

 

 

Result - If I select Client Name ABC

 

InvoiceDateClientNameInvoiceNumberInvoiceIDRemark 1Remark 2Remark 3
8/17/2021 0:00ABC817064926099123
8/17/2021 0:00ABC817065926101456
8/17/2021 0:00ABC817068926105789
8/17/2021 0:00ABC817069926107101112
8/17/2021 0:00XYZ817071926169131415
8/17/2021 0:00XYZ817077926112131415
8/17/2021 0:00XYZ817078926114131415
8/17/2021 0:00XYZ817087926134131415
8/17/2021 0:00XYZ817088926136131415

 

Result - If I select client name XYZ

 

InvoiceDateClientNameInvoiceNumberInvoiceIDRemark 5Remark 8Remark 9
8/17/2021 0:00ABC817064926099ABC
8/17/2021 0:00ABC817065926101ABC
8/17/2021 0:00ABC817068926105ABC
8/17/2021 0:00ABC817069926107ABC
8/17/2021 0:00XYZ817071926169131415
8/17/2021 0:00XYZ817077926112202122
8/17/2021 0:00XYZ817078926114232425
8/17/2021 0:00XYZ817087926134262728
8/17/2021 0:00XYZ817088926136293031
  • Hi gauravnarchal ,

     

    I test two ways to achieve it.

     

    1. Add bookmarks. 

     

    Referencing: https://www.youtube.com/watch?v=FBEF1xMxxEE 

     

     

    2. Unpivot columns.

    • Unpivot columns in Power Query Editor.

     

    • Create a calculation table.
    ClientName = DISTINCT('Table'[ClientName])

    • Create the following measures.
    Measure = 
    IF(
        SELECTEDVALUE(ClientName[ClientName]) = "ABC", 
        COUNTROWS(
            INTERSECT(
                CALCULATETABLE(
                    VALUES('Table'[Attribute]),
                    FILTER(
                        'Table',
                        'Table'[Attribute] in {"Remark 1", "Remark 2", "Remark 3"}
                    )
                ),
                DISTINCT('Table'[Attribute])
            )
        ),
        COUNTROWS(
            INTERSECT(
                CALCULATETABLE(
                    VALUES('Table'[Attribute]),
                    FILTER(
                        'Table',
                        'Table'[Attribute] in {"Remark 5", "Remark 8", "Remark 9"}
                    )
                ),
                DISTINCT('Table'[Attribute])
            )
        )
    )
    RemarkValue = MAX('Table'[Value])
    • Filter the matrix by Measure.

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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

2 Replies

  • gauravnarchal , I think you need bookmarks and button for that. Slicer might not help

     

    bookmark -https://blog.crossjoin.co.uk/2018/04/20/dynamically-changing-a-chart-axis-in-power-bi-using-bookmarks-and-buttons/

  • v-kkf-msft's avatar
    v-kkf-msft
    Community Support

    Hi gauravnarchal ,

     

    I test two ways to achieve it.

     

    1. Add bookmarks. 

     

    Referencing: https://www.youtube.com/watch?v=FBEF1xMxxEE 

     

     

    2. Unpivot columns.

    • Unpivot columns in Power Query Editor.

     

    • Create a calculation table.
    ClientName = DISTINCT('Table'[ClientName])

    • Create the following measures.
    Measure = 
    IF(
        SELECTEDVALUE(ClientName[ClientName]) = "ABC", 
        COUNTROWS(
            INTERSECT(
                CALCULATETABLE(
                    VALUES('Table'[Attribute]),
                    FILTER(
                        'Table',
                        'Table'[Attribute] in {"Remark 1", "Remark 2", "Remark 3"}
                    )
                ),
                DISTINCT('Table'[Attribute])
            )
        ),
        COUNTROWS(
            INTERSECT(
                CALCULATETABLE(
                    VALUES('Table'[Attribute]),
                    FILTER(
                        'Table',
                        'Table'[Attribute] in {"Remark 5", "Remark 8", "Remark 9"}
                    )
                ),
                DISTINCT('Table'[Attribute])
            )
        )
    )
    RemarkValue = MAX('Table'[Value])
    • Filter the matrix by Measure.

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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