Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Rolling average per second and minute
I need help on a moving average per second and minute. I’ve surfed the web for many days now, I’ve tried most of the posted solutions but I cannot seem to crack it.
I’m trying to determine a moving average for events [TPS] per time stamp, in this case the rolling average looking at seconds in a minute. Once I have total events per second, I would like to calculate the rolling average per minute.
I’ve created a new table with ‘DateTimeTable’ so I could have a calendar with all-time stamps for a period (this case 3 months), and used a left outer join to join it with the table ‘TokenMA60’ containing the data. The [ifisblank] looks if an event 'TokenMA
' occured and if not returns a zero or if, a value of 1. I tried using a below or over fuction that can be done with SQL.
Below I have an excel example of what I would like to achieve, rather easy with a pivot:
Below the data in Power Bi (desktop)
Has anyone ever achieved this in with DaX/PowerBi?
Regards
Solved! Go to Solution.
Hi @niel_orvyn1 ,
We can use the following steps to meet your requirement.
1. We need to create a new calculate column to get the every minute.
Datetime 1 = FORMAT('Table'[Datetime],"YYYY/mm/dd hh:mm:00")
2. Then create a measure. You can replace the SUM with AVERAGE.
Measure = CALCULATE(SUM('Table'[ifisblank]),FILTER(ALLSELECTED('Table'),'Table'[Datetime]<=MAX('Table'[Datetime])))
And create a table, put the [Datetime 1] and [Measure] in it. The result like this,
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @niel_orvyn1 ,
We can use the following steps to meet your requirement.
1. We need to create a new calculate column to get the every minute.
Datetime 1 = FORMAT('Table'[Datetime],"YYYY/mm/dd hh:mm:00")
2. Then create a measure. You can replace the SUM with AVERAGE.
Measure = CALCULATE(SUM('Table'[ifisblank]),FILTER(ALLSELECTED('Table'),'Table'[Datetime]<=MAX('Table'[Datetime])))
And create a table, put the [Datetime 1] and [Measure] in it. The result like this,
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Apologies for back tracking:
When I use as per below "2. Then create a measure. You can replace the SUM with AVERAGE."
It works perfectly the column with [Datetime], the one that contains seconds:
However on the right hand column containing [Datetime 1], its appears to give the moving average per the [Datetime] column. For the moving average where I would like to calculate:
Hope my question is making sense.
Let me know if you can help.
Many thanks,
Niel
Hi
I @v-zhenbw-msft am very gratefull, I've spent days searching for the solution, I've googled almost every topic in this regard.
If you have any links for ramp up of PowerBi skills please share. I've done DAT207x however, it only touches the surface of PowerBi, just my opinion and want to learn more.
Best,
Niel
This Avg should reset every day or continue as is?
Hi
The avg should continue and not reset everyday. The orig data is events over a 3 months period and I would like to see the average of events over the 3 months.
Thanks in advance.
Regards,
Niel
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
99 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |