Forum Discussion
Topn Function.
- 10 years ago
Hi Weilip,
According to your description, you need to get the top 10 count for your group, right?
I have tested it on my local environment, the steps below are for you reference.
- Create a calculated column in your original table using the expression below.
Count=CALCULATE(COUNTA(Sheet1[Subgroup]),ALLEXCEPT(Sheet1,Sheet1[GroupName])) - Create a new table use the expression below
TOP10 = TOPN(10,SUMMARIZE(Original,Original[GroupName]),[Measure]) - Add a new column in new created table.
Count = LOOKUPVALUE(Original[count],Original[GroupName],'TOP10'[GroupName])
Regards,
Charlie Liao
- Create a calculated column in your original table using the expression below.
Hi Weilip,
According to your description, you need to get the top 10 count for your group, right?
I have tested it on my local environment, the steps below are for you reference.
- Create a calculated column in your original table using the expression below.
Count=CALCULATE(COUNTA(Sheet1[Subgroup]),ALLEXCEPT(Sheet1,Sheet1[GroupName])) - Create a new table use the expression below
TOP10 = TOPN(10,SUMMARIZE(Original,Original[GroupName]),[Measure]) - Add a new column in new created table.
Count = LOOKUPVALUE(Original[count],Original[GroupName],'TOP10'[GroupName])
Regards,
Charlie Liao
- ElliotP10 years agoPost Prodigy
v-caliao-msftFantastic, Helped me out a lot!
- seena9 years agoFrequent Visitor
TOP10 = TOPN(10,SUMMARIZE(Original,Original[GroupName]),[Measure])
Can the value ' 10' be dynamically selected? ---topn[topnvalue]
If I try to replace it with [SelectedTopNNumber] where [SelectedTopNNumber]=value(topn[topnvalue]) , it throws me the below error,
MdxScript(Model) (17, 35) A table of multiple values was supplied where a single value was expected