Forum Discussion
Adding a TOPN Filter to a Measure
- 4 years ago
Here is a more accurate representation that also works on line level.
SU Top10 = var mw = MAXX(all(Weekly),[YYYYWW]) var ft = filter(all(Weekly),[YYYYWW]=mw) var ms = SUMMARIZE(ft,[Short Name] ,"s",sum([Sales Units])) var tt = SELECTCOLUMNS(TOPN(10,ms,[s]),"Widget",[Short Name]) var mc = SUMMARIZE(Weekly,[Short Name] ,"s",sum([Sales Units])) var mf = filter(mc,[Short Name] in tt) return sumx(mf,[s])
Hi lbendlin
Thank you for your offer to help
I have created a sanatised file and a pbix file so you can see what I am trying to do.
I hope this helps
Here is a link to a OneDrive folder
https://1drv.ms/u/s!AgfQYi2RKbVJ41vWBFkOeunfki0h?e=C1XAf2
When you say "Top 10 (12 wks)" do you mean the top 10 for the entire range of 12 weeks, or do you want to consider all accounts that are in the Top 10 in each of the 12 weeks?
- LUCASM4 years ago
Helper IV
Hi lbendlin
Apologise for the delay in responding
What I am attempting to do is CALCULATE the SUM(Volume) of ONLY the TOP 10 "Short Names" in the Latest Week over the last 12 weeks
DIVIDED BY
The Total SUM(Volume) over 12 weeks.
So Basically if you look at the Filters used to create the Top 10 Volume (12 Wks) - 302,717
can this be written as a Measure?
edit:
the confusing thing is that I only want to incude those products which appear in the current week top 10 and not what is the the real market share over 12 weeks.
This is because the table shows the current top 10 by volume and what their sales were over the last 12 weeks.
So the card above - in the pbix, needs to show the sum of the top 10 in the table
and then divide that top 10 by the Total
- lbendlin4 years ago
Super User
That makes it easier to calculate but it will be more confusing for your users. make sure to add wordage to the page explaining what they are looking at.
Now you would need to define what you mean by "current week".
- LUCASM4 years ago
Helper IV
Current week = Index_Week 1
or MAX(YYYYWW)