Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Showing only Bottom N values in chart

Hi All,   I want to show bottom 5 values based on count. Let me clarify more:   There are two columns - product_id & product. I want to show bottom 5 products based on count(product_id). Means wh...
  • DoubleJ's avatar
    9 years ago

    Hi 

     

    The following might be a solution. If I got you right, a product can be multiple times in your table. 

     

     

    1. Create A Measure "ProductsCount"

    ProductsCount = COUNTROWS(Products) 

     

    2. The question now is: Which 5 of the 22 products shall be displayed? I created a column "SortValue" that takes the ProductId in account. Multiplying the "ProductsCount" measure by 1000000 and then adding the ProductID gives each Product a unique "SortValue". Of course this approach only works if the ProductID is an integer value.

    SortValue = [ProductsCount]*100000 + Products[ProductId] 

    3. You can now create a visual with the  Bottom 5 filter set on "SortValue"


    Of course the formula for the "SortValue" formula depends on your actual data. 

     

    I hope this helps!

    JJ