Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi! I’m trying to make 4 visual tables on one page show metrics for different weeks with the dates being controlled by on slicer.
My fact table is related to my date table through the Reporting Date column, and that Reporting Date is always a Monday (the day the weekly report is pulled).
I want to use a slicer where, when I select a specific Monday:
• Visual Table 1 displays metrics for that selected week.
• Visual Table 2 automatically displays metrics for the week immediately before it (selected week − 7 days).
• Visual Table 3 displays metrics for two weeks prior (selected week − 14 days).
• Visual Table 4 displays metrics for three weeks prior (selected week − 21 days).
When the slicer selection changes, the “current week” table should update to the newly selected week, and each subsequent table should automatically shift relative to that new selection.
All tables have the same measures. Is this possible?
Solved! Go to Solution.
It's possible.
The scenario you describe is essentially a kind of time intelligence, which can be achieved through measurement values and calculation groups.
like this.
Measure = MIN('dim_date'[date])&"~"&MAX('dim_date'[date]) |
Measure - 7 day = CALCULATE( [Measure] ,DATEADD('dim_date'[date],-7,DAY) ) |
Measure - 14 day = CALCULATE( [Measure] ,DATEADD('dim_date'[date],-14,DAY) ) |
Measure - 21 day = CALCULATE( [Measure] ,DATEADD('dim_date'[date],-21,DAY) ) |
Another way is to write code in a calculation group that can be applied to different measures, which looks like different slicers are used
Selected Week =
SELECTEDVALUE('Date'[Date])
Make sure:
Your slicer is single-select
It uses the Date table (not the fact table)
Step 2) Create offset measures
Metric – Week 0 =
VAR SelectedMonday = [Selected Week]
RETURN
CALCULATE(
[Your Metric],
'Date'[Date] = SelectedMonday
)
Metric – Week -1 =
VAR SelectedMonday = [Selected Week]
RETURN
CALCULATE(
[Your Metric],
'Date'[Date] = SelectedMonday - 7
)
Metric – Week -2 =
VAR SelectedMonday = [Selected Week]
RETURN
CALCULATE(
[Your Metric],
'Date'[Date] = SelectedMonday - 14
)
Metric – Week -3 =
VAR SelectedMonday = [Selected Week]
RETURN
CALCULATE(
[Your Metric],
'Date'[Date] = SelectedMonday - 21
)
Please find the below steps to achieve that
Fact Table
Date Dimension Table
Hence, All values matching as per source data
We can also make it dynamic within a single measure – Please feel free to let us know if you need any help around that
Hi @Sdd15c ,
We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.
Hi @Sdd15c ,
Thanks for reaching out to Microsoft Fabric Community.
Just wanted to check if the responses provided were helpful. If further assistance is needed, please reach out.
Thank you.
Please find the below steps to achieve that
Fact Table
Date Dimension Table
Hence, All values matching as per source data
We can also make it dynamic within a single measure – Please feel free to let us know if you need any help around that
Thank you!!
Selected Week =
SELECTEDVALUE('Date'[Date])
Make sure:
Your slicer is single-select
It uses the Date table (not the fact table)
Step 2) Create offset measures
Metric – Week 0 =
VAR SelectedMonday = [Selected Week]
RETURN
CALCULATE(
[Your Metric],
'Date'[Date] = SelectedMonday
)
Metric – Week -1 =
VAR SelectedMonday = [Selected Week]
RETURN
CALCULATE(
[Your Metric],
'Date'[Date] = SelectedMonday - 7
)
Metric – Week -2 =
VAR SelectedMonday = [Selected Week]
RETURN
CALCULATE(
[Your Metric],
'Date'[Date] = SelectedMonday - 14
)
Metric – Week -3 =
VAR SelectedMonday = [Selected Week]
RETURN
CALCULATE(
[Your Metric],
'Date'[Date] = SelectedMonday - 21
)
Thank you!!
It's possible.
The scenario you describe is essentially a kind of time intelligence, which can be achieved through measurement values and calculation groups.
like this.
Measure = MIN('dim_date'[date])&"~"&MAX('dim_date'[date]) |
Measure - 7 day = CALCULATE( [Measure] ,DATEADD('dim_date'[date],-7,DAY) ) |
Measure - 14 day = CALCULATE( [Measure] ,DATEADD('dim_date'[date],-14,DAY) ) |
Measure - 21 day = CALCULATE( [Measure] ,DATEADD('dim_date'[date],-21,DAY) ) |
Another way is to write code in a calculation group that can be applied to different measures, which looks like different slicers are used
Thank you!!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 74 | |
| 72 | |
| 39 | |
| 35 | |
| 23 |