The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I have a dataset that contains batch numbers and cycle times for each batch number. I am trying to create a rolling average over the last 5 batches to plot. Those are the only two variables - I do not have access to dates. I have tried to make an index column of dates, and I have tried other solutions that have been presented on this forum for similar situations including this one, to no avail.
Any help would be much appreciated.
Solved! Go to Solution.
I found out how to do it minutes after I posted on the forum. I found a calculated column code which works exactly how I want it.
Column =
var my_index = 'Table'[Index]
var my_result =
AVERAGEX(
FILTER(
'Table',
'Table'[Index] > my_index-5 &&
'Table'[Index] <= my_index
), 'Table'[Parameter]
)
RETURN my_result
This makes a rolling average of the last 5 parameters. You will need to create an index column, but that's the only thing you should need to create in order to graph a rolling average.
I found out how to do it minutes after I posted on the forum. I found a calculated column code which works exactly how I want it.
Column =
var my_index = 'Table'[Index]
var my_result =
AVERAGEX(
FILTER(
'Table',
'Table'[Index] > my_index-5 &&
'Table'[Index] <= my_index
), 'Table'[Parameter]
)
RETURN my_result
This makes a rolling average of the last 5 parameters. You will need to create an index column, but that's the only thing you should need to create in order to graph a rolling average.
Hi
I'm trying to do something similar, but I'm having trouble following your references. When you create an index column, do you mean that each record within a batch got the same index number?
What do table Index and table Parameter refer to? Did you create a separate table just for the index numbers and Parameters is the actual data?
Hi @Anonymous ,
It's glad that you have solved your problem.
Please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Can you create a rank column and use?
Rank = rank(all(table),batch,,desc,dense)
last 3 period =
var _max =maxx(table,table[rank])
var _min=maxx(table,table[rank])-3
calculate(sum(table[qty]), filter(all(table),table[rank]>= _min && table[rank]>=_max ))
But move batch to a different table and then do it
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin
User | Count |
---|---|
56 | |
54 | |
54 | |
49 | |
30 |
User | Count |
---|---|
173 | |
89 | |
70 | |
46 | |
45 |