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 ,
Create the following 3 measures:
Value_Sum = SUM('Table'[Value])
Lowest =
AVERAGEX (
FILTER (
SUMMARIZE (
ALLSELECTED ( 'Table' ),
'Table'[Month],
'Table'[Value],
"@Ranking", RANKX ( ALLSELECTED ( 'Table' ), [value_Sum],, ASC, SKIP )
),
[@Ranking] <= 2
),
[value_Sum]
)
HIGHEST =
AVERAGEX (
FILTER (
SUMMARIZE (
ALLSELECTED ( 'Table' ),
'Table'[Month],
'Table'[Value],
"@Ranking", RANKX ( ALLSELECTED ( 'Table' ), [value_Sum],, DESC, SKIP )
),
[@Ranking] <= 2
),
[value_Sum]
)
If you want the [@Ranking]<= 2 can also be dinamic wiht an WHAT IF analysis.
Check PBIX file attach.
First of all, thank you for your answer...
I opened the thread in the power query. So I will analyze your suggestion, but I will keep just the question in power query thread. I'm sorry for the inconvenient.
Thank you Miguel
- MFelix6 years ago
Super User
Hi @twister8889,
You need this in Power Query?
Be aware that in Power Query the dinamic part is not as linear as in DAX, because when you select the parameters for your query to calculate after the upload they stay as you defined them then you need to reselect and refresh the query.