The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello,
I have a measure to calculate a moving average on 5 days, this works fine.
However, PBI seems to forecast my data past the end of my date max, of my last data.
The last datapoint I have is in 25/04/2020 but my average is going until the 30/04/2020. I want my data to stop on the 25/04/2020.
I have two tables : a calendar + a factable. My calendar is used for lots of other tables so its Max and Min doesn't depends on my factable.
My measure to calculate the moving average is :
Can anyone tell me how PowerBI is calculating these extra values? and why it is calculating them?
Thanks by advance,
Solved! Go to Solution.
Yes, results are correct but I do not want the 5 last dates. I've the all(dimdate) in my formula.
Actually I find a solution :
in my date table, I create a calculated column = max(factable[Date])
and then create a measure :
It is performing as expected. Look at the calculations:
54+25+14+74+0 = 167
167/5 = 33
25+14+74+0+0 = 113
113/5 = 23
14+74+0+0+0 = 18
Your calulation is looking at all dates in your date table. You need to limit your selection by dates that exist in your fact table. I'm wondering why you have the ALL() filter in __daystoavg.
Yes, results are correct but I do not want the 5 last dates. I've the all(dimdate) in my formula.
Actually I find a solution :
in my date table, I create a calculated column = max(factable[Date])
and then create a measure :
Change var like and try
var __currentday = MAXX(allselected(dim_date),dim_date[Date])
thnks but it's not working : if I change this variable, nothing appears anymore in my "moving_average" column , everything's blank ..
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
79 | |
77 | |
43 | |
39 |
User | Count |
---|---|
150 | |
117 | |
67 | |
64 | |
56 |