Build a chart a field parameter chart with full display / topn

Viewed 19

I have a field parameter containing 5 fields. I would like to build a chart where user can have full display (all values from field) or top10 if he wants to, ordered by CountOfItems

I try to build measure like

TOPN(10, SUMMARIZE(CategoryTable, CategoryTable[CategoryDescription], "@Count", [CountOfItems]), [@Count], DESC)

However I am getting an error that "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." - how to overcome that? The second question is: will it apply also filters in a report to the top10 or just calculate solely top10 regardless of filters and put it into table/chart?

How to even approach such chart?

Thank you in advance

1 Answers

Your expression looks clean. The problem could be with your measure. Can you check/add code for [CountOfItems]? I'd try to use ADDCOLUMN + SUMMATIZE.

TOPN(
    10
    ,ADDCOLUMNS(
        SUMMARIZE(CategoryTable, CategoryTable[CategoryDescription])
        ,"@Count", [CountOfItems]
    )
    ,[@Count]
    ,DESC
)

For the second question the answer - Yes, all filters will be applied.

Related