Forum Discussion

arielcedola's avatar
arielcedola
Icon for Helper III rankHelper III
6 years ago
Solved

Filter 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...
  • arielcedola's avatar
    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