Forum Discussion
mjmm
1 year agoFrequent Visitor
Help with Top10 and Others visualization please.
Dear all, I have a summary of what I have so far. Prj Nr Name is a column in the '2024 Data' table % of Total Planning is a measure that I placed in the '_Measures' table % of Total Plan...
- Anonymous1 year ago
Hi mjmm ,
Here I update the code for calculated column and measure based on your sample.
Project Label_Column = VAR _SUMMARIZE = SUMMARIZE ( ALLSELECTED ( 'ExampleDataFile' ), 'ExampleDataFile'[ProjectNr], "% of Total Planning Costs 2024 _ PR", DIVIDE ( CALCULATE ( SUM ( 'ExampleDataFile'[Costs] ), 'ExampleDataFile'[Status] = "Planning", 'ExampleDataFile'[Year] IN { 2024 } ), CALCULATE ( SUM ( 'ExampleDataFile'[Costs] ), FILTER ( ALL ( 'ExampleDataFile' ), 'ExampleDataFile'[Status] = "Planning" && 'ExampleDataFile'[Year] IN { 2024 } ) ) ) ) VAR _ADDRANK = ADDCOLUMNS ( _SUMMARIZE, "Rank", RANKX ( _SUMMARIZE, [% of Total Planning Costs 2024 _ PR],, DESC ) ) VAR _ADDLabel = ADDCOLUMNS ( _ADDRANK, "Project Label", IF ( [Rank] > 10, "Others", FORMAT([ProjectNr],"") ) ) VAR _CURRENTNAME = 'ExampleDataFile'[ProjectNr] RETURN MAXX(FILTER(_ADDLabel,[ProjectNr] = _CURRENTNAME),[Project Label])Measure = VAR _SUMMARIZE = SUMMARIZE ( 'ExampleDataFile' , 'ExampleDataFile'[Project Label_Column], "% of Total Planning Costs 2024 _ PR", SUMX(VALUES(ExampleDataFile[Project Label_Column]),DIVIDE ( CALCULATE ( SUM ( 'ExampleDataFile'[Costs] ), 'ExampleDataFile'[Status] = "Planning", 'ExampleDataFile'[Year] IN { 2024 } ), CALCULATE ( SUM ( 'ExampleDataFile'[Costs] ), FILTER ( ALL ( 'ExampleDataFile' ), 'ExampleDataFile'[Status] = "Planning" && 'ExampleDataFile'[Year] IN { 2024 } ) ) ) )) RETURN SUMX(_SUMMARIZE,[% of Total Planning Costs 2024 _ PR])Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
1 year agoNot applicable
Hi mjmm ,
Here I update the code for calculated column and measure based on your sample.
Project Label_Column =
VAR _SUMMARIZE =
SUMMARIZE (
ALLSELECTED ( 'ExampleDataFile' ),
'ExampleDataFile'[ProjectNr],
"% of Total Planning Costs 2024 _ PR",
DIVIDE (
CALCULATE (
SUM ( 'ExampleDataFile'[Costs] ),
'ExampleDataFile'[Status] = "Planning",
'ExampleDataFile'[Year] IN { 2024 }
),
CALCULATE (
SUM ( 'ExampleDataFile'[Costs] ),
FILTER (
ALL ( 'ExampleDataFile' ),
'ExampleDataFile'[Status] = "Planning"
&& 'ExampleDataFile'[Year] IN { 2024 }
)
)
)
)
VAR _ADDRANK =
ADDCOLUMNS (
_SUMMARIZE,
"Rank", RANKX ( _SUMMARIZE, [% of Total Planning Costs 2024 _ PR],, DESC )
)
VAR _ADDLabel =
ADDCOLUMNS (
_ADDRANK,
"Project Label", IF ( [Rank] > 10, "Others", FORMAT([ProjectNr],"") )
)
VAR _CURRENTNAME = 'ExampleDataFile'[ProjectNr]
RETURN
MAXX(FILTER(_ADDLabel,[ProjectNr] = _CURRENTNAME),[Project Label])Measure =
VAR _SUMMARIZE =
SUMMARIZE (
'ExampleDataFile' ,
'ExampleDataFile'[Project Label_Column],
"% of Total Planning Costs 2024 _ PR",
SUMX(VALUES(ExampleDataFile[Project Label_Column]),DIVIDE (
CALCULATE (
SUM ( 'ExampleDataFile'[Costs] ),
'ExampleDataFile'[Status] = "Planning",
'ExampleDataFile'[Year] IN { 2024 }
),
CALCULATE (
SUM ( 'ExampleDataFile'[Costs] ),
FILTER (
ALL ( 'ExampleDataFile' ),
'ExampleDataFile'[Status] = "Planning"
&& 'ExampleDataFile'[Year] IN { 2024 }
)
)
)
))
RETURN
SUMX(_SUMMARIZE,[% of Total Planning Costs 2024 _ PR])
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mjmm
1 year agoFrequent Visitor
Anonymous, Wow thanks, this is exactly what I needed. Apologies for the late reply, had some personal things come up unexpectedly. Much appreciated! Thanks!