Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a project where I am trying to dynamically show bottom 3 or bottom 5 changes in YoY sales based on a slicer selected. I am also trying too create a slicer that filters for a threshold number of products sold (100, 250, 500). I would like the ranking to follow my threshold slicer so each time I select a new one the bottom 3 or 5 is refreshed to show the largest decrease in sales with a certain number of products sold.
Rank = IF(SUM(Table1[Products Sold]) > SELECTEDVALUE('Product Threshold'[Product Threshold]), RANKX(ALLSELECTED(Table1[Store Name]), SUM(Table1[YoY Sales Change]),,ASC),BLANK())
Not sure if this is possible since I just started using Power BI.
You may refer to the DAX below.
Rank = IF ( SUM ( Table1[Products Sold] ) >= SELECTEDVALUE ( 'Product Threshold'[Product Threshold] ), RANKX ( FILTER ( ALLSELECTED ( Table1[Store Name] ), CALCULATE ( SUM ( Table1[Products Sold] ) >= SELECTEDVALUE ( 'Product Threshold'[Product Threshold] ) ) ), CALCULATE ( SUM ( Table1[YoY Sales Change] ) ), , ASC ), BLANK () )
You code worked to identify which stores are above the threshold of products sold but ranked them all as 1.
I also realized I left out some details and code that may be helpful.
First is the stores are already regionally filtered so the view I showed is one region. Second is the code below.
These two lines of code determine if value shows making the 3 or 5 with a 1 thenputting a visaul filter of "Should Store be Included is 1" on the table.
SelectedTopNNumber = MIN('TopN'[Top]) Should Store Be Included = IF([Rank]<= [SelectedTopNNumber],1,0)
This code is how YoY Sales change is calculated
YoY Sales Change = DIVIDE(SUM(Table1[cur_Products Sold), SUM(Table1[Products Sold_12]),1)-1
Hopefully that helps give some more context and thank you for you help so far.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |