Disconnected slicers controlling rows in pivot table

masplin

Active Member
Joined
May 10, 2010
Messages
413
I am doing some analysis for a company that sells take away food. They are running various trails on different groups of products. I have set up a disconnected slicer with the name of the trial and the date when the trial started e.g.

Bread trail 7/9/15

This works great as i select the trial name and then can feed the date into various formulae to calculate the transactions 4 weeks before and after the date in the slicer table.

I'm hoping to extend this table so there might be cold drink, cakes trials etc in future. I'm wondering if PP is clever enough to make this even slicker. For the Bread trial they only want to see the result for specific products e.g. sandwiches/baguettes/wraps but also the change in the category group above which is "cold Food"

to do this currently I just set up a normal slicer and chose the products I need. i then need another pivot where i choose the group total. So the question is could I set up in my disconnect slicer somehow the list of products associated with that trial so that the products are picked automatically when the trial is selected? maybe I need to set up an additional table for each trial listing the products and some how include it as a filter on my calculation?

As an example my calculation look like this, where Trial slicer Date comes from the disconnected slicer.


Code:
CALCULATE(                        [Av Daily Item Count Paid],
                        FILTER(
                                     RELATEDTABLE(Transactions),
                        Transactions[Transaction Date]>=[Trial Date Slicer]-28  &&
                        Transactions[Transaction Date]<[Trial Date Slicer]
                                    )
                        )

So I am imagining an additional clause in the filter function that says something like && transactions[Sales Group] is in a table pointed at by the disconnected slicer choice.

Thanks for any advice as sure this is possible, but no idea of syntax

Mike
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
There are like... Soooo many words to read there :)

It certainly feels possible. Add a Sales Group to the disconnected slicer, then uhhh.... ummm...

Can the product associated with a gift transaction be part of mulitple Sales Groups? If we pretend "no", then ... FILTER(Transactions, Transactions[Sales Group] = MIN(DisconnectedLookup[Sales Group])) ?
 
Upvote 0
Sorry I was trying to explain it fully!!!

In this case there are 3 sales groups affected by the trial so you are filtering for a variable number of sales groups. so i am guessing I need some kind of filter that says filter [sales group] if it matches any of the list in another table where that table is controlled by the disconnected slicer. Sound simple!!! I've only used filter where it equlas some fixed value, a formula or using EARLIER. Can you have it equal to able of a table column?
 
Upvote 0
Thanks for point in the right direction. Not very elegant, but I'm working on it.

First I created a table bread_all, with the list of stores & list of sales groups in the trial.

[TABLE="width: 234"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Store[/TD]
[TD]Alt Sales Group[/TD]
[/TR]
[TR]
[TD]CST[/TD]
[TD]Baguettes[/TD]
[/TR]
[TR]
[TD]CRD[/TD]
[TD]Sandwiches[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Wraps[/TD]
[/TR]
</tbody>[/TABLE]

Then I amended my measure as follows where all transactions are related to a table PLU

Code:
CALCULATE(                        [Item Count Paid],
                        FILTER(
                                     RELATEDTABLE(Transactions),
                        Transactions[Transaction Date]>=[Trial Date Slicer]-28  &&
                        Transactions[Transaction Date]<[Trial Date Slicer] &&
                      CONTAINS(VALUES(bread_All[Alt Sales Group]),bread_All[Alt Sales Group],RELATED(PLU[Alt Sales Group]))  &&
                      CONTAINS(VALUES(bread_All[Store]),bread_All[Store],RELATED(Location[Store Code]))
                                    )
                        )/
       [Trial Days Pre]

This works perfectly as only calculated the measure if the store is in the list and for the sales groups required.

Now i just need to work out how to combine this with the date slicer I started with to have an elegant solution for a long list of trials. I think this involves a calculatetable. I also need to do the control group.
 
Upvote 0
Hi Scott I am very close to what i'm after but obviously making a schoolboy error somewhere because the grand total isn't the grand total!!!

This is the table that determines the inputs to the measures

[TABLE="width: 623"]
<tbody>[TR]
[TD]Trial/Promo[/TD]
[TD]Store[/TD]
[TD]Alt Sales Group[/TD]
[TD]Control Major Group[/TD]
[TD]Control Stores[/TD]
[/TR]
[TR]
[TD]Portion Size Porridge Nov15[/TD]
[TD]CST[/TD]
[TD]Porridge[/TD]
[TD]Hot Breakfast[/TD]
[TD]HLB[/TD]
[/TR]
[TR]
[TD]Portion Size Porridge Nov15[/TD]
[TD]QVS[/TD]
[TD][/TD]
[TD][/TD]
[TD]FST[/TD]
[/TR]
</tbody>[/TABLE]


This is the measure

Code:
IF(     CONTAINS(VALUES(Trial_Seg[Trial Segment]),Trial_Seg[Trial Segment],"Test"), 
  CALCULATE(
                        [Trial Item Pre],
                        FILTER(
                                     RELATEDTABLE(Transactions),
                                     CONTAINS(VALUES(Trial_Filter[Alt Sales Group]),Trial_Filter[Alt Sales Group],RELATED(PLU[Alt Sales Group]))  &&
                                     CONTAINS(VALUES(Trial_Filter[Store]),Trial_Filter[Store],RELATED(Location[Store Code]))                                    )
                        ),
       IF(
           CONTAINS(VALUES(Trial_Seg[Trial Segment]),Trial_Seg[Trial Segment],"Ex-Test"),
           CALCULATE(
                        [Trial Item Pre],
                        FILTER(
                                     RELATEDTABLE(Transactions),
                                     CONTAINS(VALUES(Trial_Filter[Control Major Group]),Trial_Filter[Control Major Group],RELATED(PLU[Major Group]))  &&
                                     NOT(CONTAINS(VALUES(Trial_Filter[Alt Sales Group]),Trial_Filter[Alt Sales Group],RELATED(PLU[Alt Sales Group])))  &&
                                     CONTAINS(VALUES(Trial_Filter[Store]),Trial_Filter[Store],RELATED(Location[Store Code]))     
                                    )
                        ),
                 blank()
                 )
         
            )

This works great as get the data split into 2 groups test and ex-test with the salt sales groups listed in one and the remaining ones in the other. The only issue is if i add a grand total i just get the total for the "test" group not both added together. Should be 49.2+485.1. Any clues why the total isn't the total?

[TABLE="width: 340"]
<tbody>[TR]
[TD]Test[/TD]
[TD]Trial Item Pre Store[/TD]
[/TR]
[TR]
[TD]Test[/TD]
[TD="align: right"]49.2[/TD]
[/TR]
[TR]
[TD]CST[/TD]
[TD="align: right"]30.9[/TD]
[/TR]
[TR]
[TD]Hot Breakfast[/TD]
[TD="align: right"]30.9[/TD]
[/TR]
[TR]
[TD]Porridge[/TD]
[TD="align: right"]30.9[/TD]
[/TR]
[TR]
[TD]QVS[/TD]
[TD="align: right"]18.3[/TD]
[/TR]
[TR]
[TD]Hot Breakfast[/TD]
[TD="align: right"]18.3[/TD]
[/TR]
[TR]
[TD]Porridge[/TD]
[TD="align: right"]18.3[/TD]
[/TR]
[TR]
[TD]Ex-Test[/TD]
[TD="align: right"]485.1[/TD]
[/TR]
[TR]
[TD]CST[/TD]
[TD="align: right"]312.1[/TD]
[/TR]
[TR]
[TD]Hot Breakfast[/TD]
[TD="align: right"]312.1[/TD]
[/TR]
[TR]
[TD]Hot Breakfast Extras[/TD]
[TD="align: right"]71.6[/TD]
[/TR]
[TR]
[TD]Scrambled Eggs[/TD]
[TD="align: right"]152.7[/TD]
[/TR]
[TR]
[TD]Toasted[/TD]
[TD="align: right"]87.9[/TD]
[/TR]
[TR]
[TD]QVS[/TD]
[TD="align: right"]173.0[/TD]
[/TR]
[TR]
[TD]Hot Breakfast[/TD]
[TD="align: right"]173.0[/TD]
[/TR]
[TR]
[TD]Hot Breakfast Extras[/TD]
[TD="align: right"]54.5[/TD]
[/TR]
[TR]
[TD]Scrambled Eggs[/TD]
[TD="align: right"]87.9[/TD]
[/TR]
[TR]
[TD]Toasted[/TD]
[TD="align: right"]30.6[/TD]
[/TR]
[TR]
[TD]Grand Total[/TD]
[TD="align: right"]49.2[/TD]
[/TR]
</tbody>[/TABLE]

Any steer appreciated as almost perfect

Thanks
Mike
 
Upvote 0
Cracked it. The grand total includes several of the Trial Segments so actually it gets caught by the first if statement. so adding the HASONEVALUE sorts it.

Code:
IF(      HASONEVALUE(Trial_Seg[Trial Segment]),
      IF(
           CONTAINS(VALUES(Trial_Seg[Trial Segment]),Trial_Seg[Trial Segment],"Test"), 
           CALCULATE(
                        [Trial Item Pre],
                        FILTER(
                                     RELATEDTABLE(Transactions),
                                     CONTAINS(VALUES(Trial_Filter[Alt Sales Group]),Trial_Filter[Alt Sales Group],RELATED(PLU[Alt Sales Group]))  &&
                                     CONTAINS(VALUES(Trial_Filter[Store]),Trial_Filter[Store],RELATED(Location[Store Code]))                                    )
                        ),
       IF(
           CONTAINS(VALUES(Trial_Seg[Trial Segment]),Trial_Seg[Trial Segment],"Ex-Test"),
           CALCULATE(
                        [Trial Item Pre],
                        FILTER(
                                     RELATEDTABLE(Transactions),
                                     CONTAINS(VALUES(Trial_Filter[Control Major Group]),Trial_Filter[Control Major Group],RELATED(PLU[Major Group]))  &&
                                     NOT(CONTAINS(VALUES(Trial_Filter[Alt Sales Group]),Trial_Filter[Alt Sales Group],RELATED(PLU[Alt Sales Group])))  &&
                                     CONTAINS(VALUES(Trial_Filter[Store]),Trial_Filter[Store],RELATED(Location[Store Code]))     
                                    )
                        ),
           blank()
          )
        ),
             CALCULATE(
                        [Trial Item Pre],
                        FILTER(
                                     RELATEDTABLE(Transactions),
                                     CONTAINS(VALUES(Trial_Filter[Control Major Group]),Trial_Filter[Control Major Group],RELATED(PLU[Major Group]))  &&
                                     CONTAINS(VALUES(Trial_Filter[Store]),Trial_Filter[Store],RELATED(Location[Store Code]))     
                                    )
                        )
          )
 
Upvote 0

Forum statistics

Threads
1,224,129
Messages
6,176,533
Members
452,735
Latest member
CristianCaruceriu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top