Forum Discussion
arielcedola
Helper III
6 years agoFilter context issue trying to visualize top ranked items in different categories
Hi, I'm working with a dataset containing the subcategories Area, Product and Article for different Shops, and the amount of sales by Article. For each shop the ranking of Area is determined accordi...
- 6 years ago
Solved. I modified the measure as follows:
NSalesBarChart = VAR CurrentShop = CALCULATE(SELECTEDVALUE(TabellaShop[Shop])) VAR Rank1Article = CALCULATE( SELECTEDVALUE(Sales[Article]), FILTER(VALUES(Sales[Article]), [Rank Article] = 1) ) RETURN CALCULATE(MIN(Sales[ArticleNSales]), FILTER(ALL(Sales), Sales[Article] = Rank1Article && Sales[Shop] = currentShop))I created an auxiliary table with the names of the shops (TabellaShop) and used these values on the x-axis of the bar chart. I filter the shop using this as a way to ignore the Shop filter context, applied rather to the selection of the top ranked Article to visualize.
Best,
Ariel
arielcedola
Helper III
6 years agoSolved. I modified the measure as follows:
NSalesBarChart =
VAR
CurrentShop = CALCULATE(SELECTEDVALUE(TabellaShop[Shop]))
VAR
Rank1Article = CALCULATE(
SELECTEDVALUE(Sales[Article]),
FILTER(VALUES(Sales[Article]), [Rank Article] = 1)
)
RETURN
CALCULATE(MIN(Sales[ArticleNSales]), FILTER(ALL(Sales), Sales[Article] = Rank1Article && Sales[Shop] = currentShop))I created an auxiliary table with the names of the shops (TabellaShop) and used these values on the x-axis of the bar chart. I filter the shop using this as a way to ignore the Shop filter context, applied rather to the selection of the top ranked Article to visualize.
Best,
Ariel
- stevedep6 years ago
Memorable Member
Nice! Thats a more elegant way to implement.