Forum Discussion

george_o0802's avatar
george_o0802
Regular Visitor
2 years ago
Solved

Top 5 and Bottom 5 in same table

Previous solutions don't seem to work so I need some clearer guidance I think. Below is what I want the results to look like   I have ranked a set of products by RSV and a YoY rank change. ...
  • parry2k's avatar
    2 years ago

    george_o0802 you can easily achieve this by adding following measure:

     

    Top Bottom = 
    VAR __Products = 
    FILTER ( 
        ADDCOLUMNS ( 
            SUMMARIZE ( 
                ALLSELECTED ( Products[Product] ), 
                Products[Product] 
            ), 
            "@Sale", [Sales] 
        ), 
        NOT ISBLANK ( [@Sale] ) 
    )  
    RETURN
    CALCULATE ( 
        [Sales],
        KEEPFILTERS ( 
            UNION (
                TOPN ( 5, __Products, [@Sale], ASC ),
                TOPN ( 5, __Products, [@Sale] )
            )
        )
    )