Forum Discussion

dunnj515's avatar
dunnj515
Regular Visitor
8 years ago
Solved

Slicer: Data values in one table equal column names in another

Hi. I'm new to Power BI. I'm trying to create a slicer using the values in one table to toggle which columns display in another table. The values in table 1 are equal to the column name in table 2. I'm simplifying somewhat, but this is the basic idea:

 

STATE
A
B
C
 

 

NameABCTOTAL
John20.1221.1213.1554.39
Susan012.1214.927.02
Gary14.120.12014.24

 

In the slicer, I'd like to select A and Cand have it update table 2 and some other visuals such as a donut chart based on Table 2 as well as recalculate the totals. Is there a way to do this? I tried adding a relationship between table 1 and table 2, but I'm unable to create a relationship between values in one table and the column names in another.

 

Thanks!

  • Anonymous's avatar
    Anonymous
    8 years ago

    In your data, you want to make sure that you import it into your model as unpivoted.  You can do this in the Query editor under the Tranform area of the ribbon.  You want to get your data to be in a format such that each row has the columns Name, State, and Amount.

     

    Once you have that imported you can create a slicer based on your State Column, which will display just a distinct list of your imported state values.

     

    Next you can create a Matrix visual.  Put Name into the rows. Put State into the columns and put Amount into value and select the aggregation of Sum.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    In your data, you want to make sure that you import it into your model as unpivoted.  You can do this in the Query editor under the Tranform area of the ribbon.  You want to get your data to be in a format such that each row has the columns Name, State, and Amount.

     

    Once you have that imported you can create a slicer based on your State Column, which will display just a distinct list of your imported state values.

     

    Next you can create a Matrix visual.  Put Name into the rows. Put State into the columns and put Amount into value and select the aggregation of Sum.

    • dunnj515's avatar
      dunnj515
      Regular Visitor

      Anonymous Thank you so much! Unpivoting the individual columns into a single STATE column and using the Matrix visual did exactly what I needed.