简体   繁体   中英

MDX query top 10 on several levels

Is there anyway that we can get the top 10 throught out the hierarchy instead of top level in MDX. I would like to write an MDX query which pulls the top 10 at each level in the hierarchy. Please let me know if it is possible.

Hierarchy looks something like below:

  • Regions(get Top 10)
    • Countries(get Top 10)
      • States(get top 10)
        • Cities(get top 10)
          • So on...

If you want to get the top 10 on a level you can use

TopCount([your dimension].[Regions].Members, 10, 'your measure')
TopCount([your dimension].[Countries].Members, 10, 'your measure')
...

If you want to get the top 10 regions with their top 10 countries... You can use DrilldownLevelTop :

DrilldownLevelTop(TopCount([your dimension].[Regions].Members, 10, 'your measure'), 10,, 'your measure')

You have to add other DrilldownLevelTop around the previous expression if you want to get the members on the other levels.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM