Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Table - DAily Avg
| DateID | DailyAvg |
| 01/01/2020 | 500 |
| 01/07/2020 | 500 |
| 01/14/2020 | 500 |
| 01/21/2020 | 500 |
Table Inventory
| DateID | Inventory |
| 01/01/2020 | 2000 |
| 01/02/2020 | 2222 |
| 01/03/2020 | 4566 |
| 01/04/2020 | 5632 |
I have a requirement where i have to calculate 4 weeks average value and display the value only against the latest inventory date. Future Dates and past dates should show blank. If there is no selecion on Date , then it should display the 4 week average too
Expected Output when filtered on date
| Date | Inventory | 4 weeks avg |
| 01/01/2020 | 2000 | |
| 01/02/2020 | 2222 | |
| 01/03/2020 | 4566 | |
| 01/04/2020 | 5632 | 500 |
Expected Output when there is no selection on date
| 4 weeks avg |
| 500 |
Measure i have developed so far is not giving the expected result. It shows values for previous dates as well.
VAR DateSelection = SELECTEDVALUE('Date'[Calendar Date])
VAR Tab1 = SUMMARIZE (
'DailyAvg',
" Final", CONVERT (
SUM ( 'DailyAvg'[DailyAvg] )/28,
DOUBLE
) )
VAR Tab2= ADDCOLUMNS(Tab1,"InventoryDate",MAX('Inventory'[DateID]))
VAR Val = SUMX(Tab2,[Consensus Final])
VAR MDate= MAX('Inventory'[DateID]
RETURN IF(DateSelection=[MAxInventoryDate] OR DateSelection=BLANK() , result,BLANK())
Please help. Thanks in Advance
@gardas_swathi , refer if my Week blog can help, it uses week rank. The rolling formula is available in blog or comments
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
HI Amit,
Thanks for your response. my Data model already has daily average calculated and its populated from the source . I am able to get the avg for the 4 weeks. Its straight forward in my scenario. SUM(DailyAvg)/28
All i need to do is display this value based on the inventory max availability date. If the inventory max date is 9/2 i need to display the value for that date
@gardas_swathi , not very clear. But you can get data for the last available date. But will not work when day is axis or group, then you need use allexcept
lastnonblankvalue(Table[Date],sum([Value]))
calculate( lastnonblankvalue(Table[Date],sum([Value])),allexcept (Table[Week]))
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 12 | |
| 10 | |
| 8 |