This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hiya All,
I have a 7 day moving average code as shown below :
7 day MA =
CALCULATE(
AVERAGEX(SUMMARIZE('Date Table', 'Date Table'[Date]),
'Measures tray'[Total Sales]),
DATESINPERIOD('Date Table'[Date],LASTDATE('Date Table'[Date]) ,-7,DAY)
)But the date table is of course auto-populating to the current date - which is 5th of may. But the fact table currently has data updated only till 29th of Apr.
Is it possible to suitably modify this code, to include a date filter to filter for only date <=29/04/2022?
[I know this can be done thru' the filter on the page but I wanted to solve it thru' the code itself]
Thanks and really appreciate your time
Best
Solved! Go to Solution.
Did you try using the date from your Fact table instead of Dates Table?
As in LASTDATE(DatefromFactTable)
That works of course - but I wanted to avoid that, since I have generated a date table separately and wanted to work off that, with filters to filter to the dates I want to keep in the visual
That works of course - but I wanted to avoid that, since I have generated a date table separately and wanted to work off that, with filters to filter to the dates I want to keep in the visual
Did you try using the date from your Fact table instead of Dates Table?
As in LASTDATE(DatefromFactTable)
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 28 | |
| 23 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 49 | |
| 47 | |
| 41 | |
| 21 | |
| 19 |