The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Solved! Go to Solution.
One way to smooth out a line like this is to use a moving average. The following code creates a moving 20 minute average. You can change the number of minutes for the moving average by changing the variable called _minsToAvg
Tank Level Smoothed =
var _minsToAvg = 20
var _dayFraction = _minsToAvg / (24*60)
var _currentDateTime = MAX( data[EventDate])
var _startOfAvg = _currentDateTime - _dayFraction
var result = AVERAGEX (
FILTER (
ALL ( data ),
data[EventDate] > _startOfAvg
&& data[EventDate] <= _currentDateTime
),
CALCULATE(SUM(data[TankLevel]))
)
return result
The above measure produces the following output
One way to smooth out a line like this is to use a moving average. The following code creates a moving 20 minute average. You can change the number of minutes for the moving average by changing the variable called _minsToAvg
Tank Level Smoothed =
var _minsToAvg = 20
var _dayFraction = _minsToAvg / (24*60)
var _currentDateTime = MAX( data[EventDate])
var _startOfAvg = _currentDateTime - _dayFraction
var result = AVERAGEX (
FILTER (
ALL ( data ),
data[EventDate] > _startOfAvg
&& data[EventDate] <= _currentDateTime
),
CALCULATE(SUM(data[TankLevel]))
)
return result
The above measure produces the following output
I am trying this with the data set and i get a circular dependency error?
Could you explain what i am doing wrong?
@Rogiervanweert Use a measure instead of a calculated column.
/ J
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 June 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
93 | |
81 | |
63 | |
56 |
User | Count |
---|---|
248 | |
123 | |
111 | |
78 | |
74 |