Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Using a Pie Chart as Slicer

Hey guys:

 

Trying to use a pie chart as a slicer and something just isn't clicking for me, hoping you could help

 

If I have a table 

 

StoreApplesBananasOranges
Kroger100
Kroger101
Kroger101
Walmart110
Walmart111
Walmart110
Publix101
Publix010

 

Where if the store carries the product there is a 1 in the cell

 

I have one visualization that is bar chart of count of store so Kroger-3, WalMart - 3, and Publix - 2 and a pie chart that is the sum of Apples at 47%, Bananas at 27% and Oranges at 27%. 

 

If I click on the store name the pie chart will adjust, but if click on a slice of the pie I would like only the stores that carry that item (1 in the column) to be sliced through in the bar chart.

 

What am I missing on this? Sorry if it is super elementary.

 

Chris 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    It is really a question of how your data is modelled. There is no link between stores (rows) and product (columns) so we need to bring it together a bit better.

     

    If you go to Query Editor, select the three columns (Apples, Bananas and Oranges), right click and select Unpivot Columns. you should get a result like the below:

     

     

    KrogerApples1
    KrogerBananas0
    KrogerOranges0
    KrogerApples1
    KrogerBananas0
    KrogerOranges1
    KrogerApples1
    KrogerBananas0
    KrogerOranges1
    WalmartApples1
    WalmartBananas1
    WalmartOranges0
    WalmartApples1
    WalmartBananas1
    WalmartOranges1
    WalmartApples1
    WalmartBananas1
    WalmartOranges0
    PublixApples1
    PublixBananas0
    PublixOranges1
    PublixApples0
    PublixBananas1
    PublixOranges0

     

     

    You can then Close and Apply then use the Attribute column (Apples, Bananas, Oranges) as your Details and the Value column (1,0) as your Values in your pie chart.

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Makes sense! So my topic has many things you can imagine, friuts, veggies, breads, etc. So what I was thinking was rather than unpivot one sheet multiple times have a record number and split the sheets up into a fruit sheet, veggie sheet, bread sheet, etc. So rather than. 

       

      StoreApplesBananasOrangesLettuceCabbagePeppersWhite BreadWheat BreadBreadsticks
      Kroger100101100
      Kroger101001111
      Kroger101100010
      Walmart110010001
      Walmart111111010
      Walmart110001111
      Publix101100100
      Publix010000101

       

      Where you would unpivot 3 times (really making the processor work, my data set make the linking take an hour) I did

       

      IDStore
      1Kroger
      2Kroger
      3Kroger
      4Walmart
      5Walmart
      6Walmart
      7Publix
      8Publix

       

       

      IDApplesBananasOranges
      1100
      2101
      3101
      4110
      5111
      6110
      7101
      8010

       

       

      IDLettuceCabbagePeppers
      1101
      2001
      3100
      4010
      5111
      6001
      7100
      8000

       

       

      IDWhite BreadWheat BreadBreadsticks
      1100
      2111
      3010
      4001
      5010
      6111
      7100
      8101

       

      So I only unpivot once, but on three different tables. 

       

      However when linking based on ID number the graphs do not interact. Do they have to be in one sheet to interact or am I missing something?

       

      Thanks,

      Chris 

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

        hi, Anonymous

        For these tables you need to create a relationship based on ID number like this, keep Cross filter direct is Both

        201812038

         

        Then the graphs will do interact.

         

        Best Regards,
        Lin