Forum Discussion
astano05
Helper III
5 years agoMeasure to Create Static Top Item List
I'm looking to create a measure that will allow me to filter out only the top 250 items. I'm connected to a live database, so I cannot create columns. I have an item, customer, and sales table. ...
- 5 years ago
Strange, perhaps try it like this.
Top 250 Item Sales = VAR _TopN = 10 VAR _TopProducts = CALCULATETABLE ( TOPN ( _TopN, ALL ( 'Item'[Item Number External] ), [Net Sales Product LY], DESC ), 'Market Channel'[Market Channel] = "ED", REMOVEFILTERS ( Customer ), ALLEXCEPT ( 'Item', 'Item'[Item Number External] ) ) RETURN CALCULATE ( [Net Sales Product YTD], FILTER ( VALUES ( 'Item'[Item Number External] ), 'Item'[Item Number External] IN ( _TopProducts ) ) ) + IF ( SELECTEDVALUE ( 'Item'[Item Number External] ) IN ( _TopProducts ), 0 )
amitchandak
Super User
5 years agoastano05 , Try measure like
Measure =
Var _tab = TOPN(250,all(Table[Item]),[Sales],DESC)
return
calculate([sales], filter(Table, Table[item] in _tab))
astano05
Helper III
5 years agoThanks for the response. I get an error with that measure that the visual can't be displayed.
I used this measure which is getting me close:
rankx(CALCULATETABLE(all('Item'),'Market Channel'[Market Channel]="ED"),[Net Sales LY])
However, the rankings still change when i change the customer using a slicer. It ranks the items in the context of the customer.