Search code examples
powerbifilteringpowerbi-desktopslicers

Power BI Slicer which select columns and not rows


I have a problem with the Power BI slicer. I have a tables that looks something like this:

Table A:

Date Article A Article B Article C
29. Nov $29.99 $129.99 $13.99
30. Nov $32.99 $132.99 $14.99
1. Dec $29.99 $135.99 $17.99
2. Dec $27.99 $137.99 $20.99

Table B:

Date Article A Article B Article C
29. Nov $32.99 $135.99 $11.99
30. Nov $29.99 $134.99 $14.99
1. Dec $27.99 $132.99 $20.00
2. Dec $25.99 $134.99 $22.99

Now I would like to create a line chart that shows the date progression on the X-axis and the price on the Y-axis. This is working fine up to this point.

Now I want to insert two slicers.

Slicer 1: Table selection (options here are: Table A, Table B) Slicer 2: Product selection (options here are: Article A, Article B, Article C)

To do this I have already tried to create a relationship between the date columns. If I create a slicer and select the articles the solution is for example: $29.99, $32.99,... but thats not that i want. If I transver the Table I have to select every single Date, so thats also not the solution.

How can i do this? Can someone help me?


Solution

  • In Power Query, you should unpivot both tables on Article A to C columns, then add a custom column, then finally, Append the two tables.

    Date Article Table Value
    29/11/2023 Article A Table A $ 29.99
    29/11/2023 Article A Table B $ 32.99
    29/11/2023 Article B Table A $ 129.99
    29/11/2023 Article B Table B $ 135.99
    29/11/2023 Article C Table A $ 13.99
    29/11/2023 Article C Table B $ 11.99
    30/11/2023 Article A Table A $ 32.99
    30/11/2023 Article A Table B $ 29.99
    30/11/2023 Article B Table A $ 132.99
    30/11/2023 Article B Table B $ 134.99
    30/11/2023 Article C Table A $ 14.99
    30/11/2023 Article C Table B $ 14.99
    01/12/2023 Article A Table A $ 29.99
    01/12/2023 Article A Table B $ 27.99
    01/12/2023 Article B Table A $ 135.99
    01/12/2023 Article B Table B $ 132.99
    01/12/2023 Article C Table A $ 17.99
    01/12/2023 Article C Table B $ 20.00
    02/12/2023 Article A Table A $ 27.99
    02/12/2023 Article A Table B $ 25.99
    02/12/2023 Article B Table A $ 137.99
    02/12/2023 Article B Table B $ 134.99
    02/12/2023 Article C Table A $ 20.99
    02/12/2023 Article C Table B $ 22.99

    With this data shape you'll have more flexibility with slicers/filters etc...