Forum Discussion
N values MIN/MAX EDITOR QUERY
- 6 years ago
twister8889
You can create two measures for AverageX measures and a table to select the count:
Download the file: https://1drv.ms/u/s!AmoScH5srsIYgYNqGMDklTewnvq8Cw?e=YVNfc3Avg Max = AVERAGEX( TOPN( [RnageNo] , 'Table' , 'Table'[Value] ,DESC), 'Table'[Value] ) Avg Min = AVERAGEX( TOPN( [RnageNo] , 'Table' , 'Table'[Value] ,ASC), 'Table'[Value] ) RnageNo = SELECTEDVALUE(Range[Value],2)Range = GENERATESERIES( 1 , CALCULATE( COUNTROWS('Table'),ALL('Table' ) ),1 )________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
twister8889
You can create two measures for AverageX measures and a table to select the count:
Download the file: https://1drv.ms/u/s!AmoScH5srsIYgYNqGMDklTewnvq8Cw?e=YVNfc3
Avg Max =
AVERAGEX(
TOPN( [RnageNo] , 'Table' , 'Table'[Value] ,DESC),
'Table'[Value]
)
Avg Min =
AVERAGEX(
TOPN( [RnageNo] , 'Table' , 'Table'[Value] ,ASC),
'Table'[Value]
)
RnageNo = SELECTEDVALUE(Range[Value],2)
Range =
GENERATESERIES( 1 ,
CALCULATE(
COUNTROWS('Table'),ALL('Table' )
),1
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
- twister88896 years ago
Helper V
First of all, thank you for your answer
I'm trying to understanding the solution, but I need to repeat the values AVG for the all months minors (< 😃 that June (red line) because the average is to six months, but when the month be July The AVG is by 7 months, Aug by 8 months. Another doubt is, until the specific month (12), all previous months need to have the same value that the max month, in this case, all months before and equal June, need to have value 0.342.
My presentation will be in the line chart, Month x Final value.
To June the expected value is 0.342 and not 0.575
The link
- Anonymous6 years agoNot applicable
Is not very clear the output expected
But if this is near your needs, you can change the number 2 inside this expression
List.Average( List.MinN(ct[value],2))
to exetnd the average to n values/months.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Pco7CsAgDADQu2ROITFK9Czi0IKVDv0gdOnpC7a6Pl6MUPIxGQIEQmOdOEgYYc1LRyYjwk33uT7nyCzBN56v2pFs8PrfMqYGbxuW7f6QkVRdgJRe", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [month = _t, value = _t]), ct= Table.TransformColumnTypes(Source,{{"month", type date}, {"value", type number}},"it-IT"), ac = Table.AddColumn(ct, "avgMin", each List.Average( List.MinN(ct[value],2))), ac1 = Table.AddColumn(ac, "avgMax", each List.Average( List.MaxN(ct[value],2))) in ac1