The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello everyone,
I have a YearWeek field in my Calendar table which selects a week's worth of data as seen below:
I'd like to know if it's possible to show the last 12 weeks (Daily data) based off the YearWeek selection. It basically needs to get the last 'Calendar'[Date] for the selected week and get me the 84 days (7 days * 12 weeks) before that time.
This is what my Calendar looks like with the YearWeek custom column:
Thank you so much for taking the time.
Solved! Go to Solution.
After some trial and error, I managed to get what I wanted by following a Youtube video titled "Show last 6 months based on user single slicer selection" from SQLBI.
I forgot to include an important part. Above the graph there's a table visualisation. The graph will only populate when an item in the table has been selected:
The measure I'm using for the graph values is this:
Metric Selection =
IF (
ISFILTERED('Table2'[MetricName]),
SWITCH(
TRUE(),
VALUES('Table2'[MetricName]) = "Name1", SUM('Daily'[Metric1]),
VALUES('Table2'[MetricName]) = "Name2", SUM('Daily'[Metric2]),
VALUES('Table2'[MetricName]) = "Name3", SUM('Daily'[Metric3]),
BLANK ()
)
)
And this is as close as I've gotten to getting a 12Week version:
12Week Metric Selection =
IF (
ISFILTERED('Table2'[MetricName]),
SWITCH(
TRUE(),
VALUES('Table2'[MetricName]) = "Name1", CALCULATE(SUM('Daily'[Metric1]), FILTER (ALLSELECTED('Calendar'),'Calendar'[Date]>= MAX ('Calendar'[Date]) - 84 && 'Calendar'[Date] <= MAX ('Calendar'[Date]))),
VALUES('Table2'[MetricName]) = "Name2", CALCULATE(SUM('Daily'[Metric2]), FILTER (ALLSELECTED('Calendar'),'Calendar'[Date]>= MAX ('Calendar'[Date]) - 84 && 'Calendar'[Date] <= MAX ('Calendar'[Date]))),
VALUES('Table2'[MetricName]) = "Name3", CALCULATE(SUM('Daily'[Metric3]), FILTER (ALLSELECTED('Calendar'),'Calendar'[Date]>= MAX ('Calendar'[Date]) - 84 && 'Calendar'[Date] <= MAX ('Calendar'[Date]))),
BLANK ()
)
)
After some trial and error, I managed to get what I wanted by following a Youtube video titled "Show last 6 months based on user single slicer selection" from SQLBI.
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |