Forum Discussion
george_o0802
2 years agoRegular Visitor
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. ...
- 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] ) ) ) )
parry2k
2 years agoSuper User
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] )
)
)
)
- george_o08022 years agoRegular Visitor
You're a wizard. Thank you.
Just so I can understand how it works a bit better as I'm relatively new to power bi and dax, I have a couple of questions.
1) Why do we put @ symbols in front of the embedded measures?
2) For whatever reason, all other titles that are not in the top 5 or bottom 5 are coming up with a rank change of 53. Why is this? It's simple enough as I can just filter out any value that is 53 but I was just curious why this was coming up and if this is a by product of something you have done here?