Forum Discussion
N values MIN/MAX EDITOR QUERY
- 6 years ago
Hi twister8889
here is my solution. Use the following measures:
Sum of Value = SUM('Table'[Value]) Highest = CALCULATE ( AVERAGEX ( TOPN ( 'TopN'[TopN Value], 'Table', [Sum of Value], DESC ), 'Table'[Value] ), ALL ( 'Table' ) ) Lowest = CALCULATE ( AVERAGEX ( TOPN ( 'TopN'[TopN Value], 'Table', [Sum of Value], ASC ), 'Table'[Value] ), ALL ( 'Table' ) )You can dowmload the pbix file here.
Regards FrankAT
Hi twister8889
here is my solution. Use the following measures:
Sum of Value = SUM('Table'[Value])
Highest =
CALCULATE (
AVERAGEX (
TOPN ( 'TopN'[TopN Value], 'Table', [Sum of Value], DESC ),
'Table'[Value]
),
ALL ( 'Table' )
)
Lowest =
CALCULATE (
AVERAGEX (
TOPN ( 'TopN'[TopN Value], 'Table', [Sum of Value], ASC ),
'Table'[Value]
),
ALL ( 'Table' )
)
You can dowmload the pbix file here.
Regards FrankAT
- twister88896 years ago
Helper V
thank you for your answer @FrankAT
I have one scenario complement: My period to find the average numbers (lowest, highest) is 7 months. So in my next example, when month 8 be load, I need to find my average (lowest, highest) to the months 2,3,4,5,6,7,8. When month 9 be load I need to find my average to the months 3,4,5,6,7,8,9. So my range of data is changing with the increase of months. After that of month 7, the average numbers (lowest, highest) can't repeat, only until July I can repeat the values to the previous month (like your print), how to improve to consider that the month 8 and months bigger, the data (lowest, highest) will not be repeated? The final table is like this:
Month Low HIgh 01/2020
0,122 0,530 02/2020 0,122 0,530 03/2020 0,122 0,530 04/2020 0,122 0,530 05/2020 0,122 0,530 06/2020 0,122 0,530 07/2020 0,122 0,530 08/2020 0,090 0,400 09/2020 0,130 0,545 Thank you so much.
- FrankAT6 years ago
Community Champion
- twister88896 years ago
Helper V
Hello, I updated the question now above, sorry.
Because my business rule is: data before month 8, needed to assume the same values that minimal range months (7). And my minimal period to calculate the average is 7 months.