Forum Discussion
Data order in visualisation
- Anonymous5 years ago
Hi Anonymous ,
Please check if this could meet your requirements.
1. Enter data to create a Rank Table.
2. Create measures.
Measure = VAR A_ = CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "A" ) VAR B_ = CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "B" ) VAR C_ = CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "C" ) VAR M1 = UNION ( ROW ( "Percent", A_, "Name", "A" ), ROW ( "Percent", B_, "Name", "B" ), ROW ( "Percent", C_, "Name", "C" ) ) VAR Result1 = MAXX ( M1, [Percent] ) VAR Result2 = MINX ( TOPN ( 2, M1, [Percent] ), [Percent] ) VAR Result3 = MINX ( M1, [Percent] ) RETURN SWITCH ( MAX ( 'Rank'[Rank] ), "1st", Result1, "2nd", Result2, "3rd", Result3 )Measure Tooltip = VAR A_ = CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "A" ) VAR B_ = CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "B" ) VAR C_ = CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "C" ) VAR M1 = UNION ( ROW ( "Percent", A_, "Name", "A" ), ROW ( "Percent", B_, "Name", "B" ), ROW ( "Percent", C_, "Name", "C" ) ) VAR Result1 = MAXX ( M1, [Percent] ) VAR Result2 = MINX ( TOPN ( 2, M1, [Percent] ), [Percent] ) VAR Result3 = MINX ( M1, [Percent] ) VAR Tooltip1 = MAXX ( FILTER ( M1, [Percent] = Result1 ), [Name] ) VAR Tooltip2 = MAXX ( FILTER ( M1, [Percent] = Result2 ), [Name] ) VAR Tooltip3 = MAXX ( FILTER ( M1, [Percent] = Result3 ), [Name] ) RETURN SWITCH ( MAX ( 'Rank'[Rank] ), "1st", Tooltip1, "2nd", Tooltip2, "3rd", Tooltip3 )Then, you can get this:
You can check more details from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Please check if this could meet your requirements.
1. Enter data to create a Rank Table.
2. Create measures.
Measure =
VAR A_ =
CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "A" )
VAR B_ =
CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "B" )
VAR C_ =
CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "C" )
VAR M1 =
UNION (
ROW ( "Percent", A_, "Name", "A" ),
ROW ( "Percent", B_, "Name", "B" ),
ROW ( "Percent", C_, "Name", "C" )
)
VAR Result1 =
MAXX ( M1, [Percent] )
VAR Result2 =
MINX ( TOPN ( 2, M1, [Percent] ), [Percent] )
VAR Result3 =
MINX ( M1, [Percent] )
RETURN
SWITCH (
MAX ( 'Rank'[Rank] ),
"1st", Result1,
"2nd", Result2,
"3rd", Result3
)Measure Tooltip =
VAR A_ =
CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "A" )
VAR B_ =
CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "B" )
VAR C_ =
CALCULATE ( SUM ( 'Table'[Percent] ), 'Table'[Name] = "C" )
VAR M1 =
UNION (
ROW ( "Percent", A_, "Name", "A" ),
ROW ( "Percent", B_, "Name", "B" ),
ROW ( "Percent", C_, "Name", "C" )
)
VAR Result1 =
MAXX ( M1, [Percent] )
VAR Result2 =
MINX ( TOPN ( 2, M1, [Percent] ), [Percent] )
VAR Result3 =
MINX ( M1, [Percent] )
VAR Tooltip1 =
MAXX ( FILTER ( M1, [Percent] = Result1 ), [Name] )
VAR Tooltip2 =
MAXX ( FILTER ( M1, [Percent] = Result2 ), [Name] )
VAR Tooltip3 =
MAXX ( FILTER ( M1, [Percent] = Result3 ), [Name] )
RETURN
SWITCH (
MAX ( 'Rank'[Rank] ),
"1st", Tooltip1,
"2nd", Tooltip2,
"3rd", Tooltip3
)
Then, you can get this:
You can check more details from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks Stephen, whilst that solution isn't what I'm after, it will come in handy for something else I'm working on!