How to create a rolling 4 month/period graph using slicer?

spraff

New Member
Joined
Oct 8, 2014
Messages
18
I have multiple graphs connected to a slicer which I have one week selected; however, I have two graphs which require multiple weeks worth of data (both images inserted below). Ideally, I'd like to select one week, and then have the two graphs populate with that week AND the prior 2 & 3 weeks respectively. But how? :confused:

2cxunit.jpg


34y9owz.jpg
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
One way of doing it:
1. Create disconnected 'week selection' table to select the latest week to display, and add as a slicer, with a [Week Selected] measure to harvest the week selected.
2. Create an [Alarm events last k weeks] measure that does a SUMX of [Alarm events] over your normal weeks dimension, but only if the week is in the required range (and defaults to blank otherwise). Then only the weeks with a non-blank measure will show up on the chart.

e.g. for current week and the two previous weeks
Code:
[Alarm events current and prev 2 weeks] =
SUMX (
    VALUES ( Weeks[Week] ),
    IF (
        Weeks[Week] <= [Week Selected]
            && Weeks[Week] >= [Week Selected] - 2,
        [Events Total]
    )
)


And actually your other charts (that only need to display one week) could drive off the same [Week Selected] slicer, with a similar measure with the condition changed to Weeks[Week] = [Week selected].
 
Upvote 0
Actually it's probably nicer to write this with FILTER instead of SUMX, but the result is the same:
Code:
[Alarm events current and prev 2 weeks] =
CALCULATE (
    [Alarm Events],
    FILTER (
        VALUES ( Weeks[Week] ),
        Weeks[Week] <= [Week Selected]
        && Weeks[Week] >= [Week Selected] - 2
    )
)
 
Upvote 0
Ozeroth,
Thanks for your reply! However, I'm afraid I'm too green to follow :(
Can you please flesh out the formula w/o the argument w/in it? :)
 
Upvote 0
No problem :) Which part do you need help with exactly? Maybe post your actual tables with some dummy data
 
Upvote 0

Forum statistics

Threads
1,226,693
Messages
6,192,464
Members
453,725
Latest member
cvsdatreas

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