Hi @cerebro ,
You can create a seperate table by entering data as follows.
Then create a calculated table
Table 2 = UNION(SELECTCOLUMNS(FILTER('Table',[topn]<=5),"Category",[Customer]),'Table (2)')
Create the measure
Values =
IF (
MAX ( 'Table 2'[Category] ) = "sum of top5",
CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', [topn] <= 5 ) ),
IF (
MAX ( 'Table 2'[Category] ) = "others",
CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', [topn] > 5 ) ),
IF (
MAX ( 'Table 2'[Category] ) = "total",
CALCULATE ( SUM ( 'Table'[Value] ), ALL ( 'Table' ) ),
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', [Customer] = MAX ( 'Table 2'[Category] ) )
)
)
)
)
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.