2 years ago
#35092
Diego Souza
PBI | Ranking dynamically based in different levels of product granularity
I hope everyone that's reading this message is having an wonderful day I'm running into a problem, that I would really appreciate your help :slightly_smiling_face:
I have a dataset in PBI, where I have to Rank per 3 different LEVELS of granularity (Cat1, Cat2, Cat3).
WHAT I WANT?
Sales Rank per Category 1 and Brand:
- I want to rank by the total Sales (Brand in Category 1) / Total Sales (Cat1)
Sales Rank per Category 2 and Brand:
- I want to rank by the total Sales (Brand in Category 2) / Total Sales (Cat2)
Sales Rank per Category 3 and Brand:
- I want to rank by the total Sales (Brand in Category 3) / Total Sales (Cat3)
Explaining further:
Example 1:
Having Category 1 filtered, Category 2 filtered and Category 3 filtered I want to:
Rank by the Sales of each Brand in each Category 3 Item / Total Sales(Cat3 item)
Columns Cat1, Cat2 and Cat3 are filtered in the Matrix
- Company ABC has 1000$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Body and segment from Cat3 Body Milk
- Company XYZ has 800$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Body and segment from Cat3 Body Milk
- Company DZA has 200$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Body and segment from Cat3 Body Milk
Find in BOLD the expected OUTPUT
Expected Output:
Brand | Cat1 | Cat2 | Cat3 | SalesQuantity | Sales MS % | Rank by MS % |
---|---|---|---|---|---|---|
ABC | Beauty | Body | Body Milk | 1000 | 50% | 1 |
XYZ | Beauty | Body | Body Milk | 800 | 40% | 2 |
DZA | Beauty | Body | Body Milk | 200 | 10% | 3 |
Example 2:
Having Category 1 filtered, Category 2 filtered and Category 3 NOT filtered I want to:
Rank by the Sales of each Brand for each Category 2 Item / Total Sales(Cat2 item)
Example:
Columns Cat1, Cat2 are filtered in the Matrix
- Company ABC has 1000$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Body
- Company ABC has 300$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Hair
- Company XYZ has 800$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Body
- Company XYZ has 500$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Hair
- Company DZA has 200$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Body
- Company DZA has 200$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Hair
- Company DZA has 250$ in Sales in the segment from Cat1 Beauty and segment from Cat2 Hands
Find in BOLD the expected OUTPUT
Expected Output:
Brand | Cat1 | Cat2 | Sales Quantity | Sales MS % | Rank by MS % |
---|---|---|---|---|---|
ABC | Beauty | Body | 1000 | 50% | 1 |
ABC | Beauty | Hair | 300 | 30% | 2 |
XYZ | Beauty | Body | 800 | 40% | 2 |
XYZ | Beauty | Hair | 500 | 50% | 1 |
DZA | Beauty | Body | 200 | 10% | 3 |
DZA | Beauty | Hair | 200 | 20% | 3 |
DZA | Beauty | Hands | 250 | 100% | 1 |
Example 3:
Having Category 1 filtered, Category 2 NOT FILTERED and Category 3 NOT FILTERED I want to:
Rank by the Sales of each Brand for each Category 1 Item / Total Sales(Cat1 item)
Example:
- Company ABC has 1000$ in Sales in the segment from Cat1 Beauty
- Company ABC has 300$ in Sales in the segment from Cat1 Home
- Company ABC has 300$ in Sales in the segment from Cat1 Men's Clothing
- Company XYZ has 800$ in Sales in the segment from Cat1 Beauty
- Company XYZ has 500$ in Sales in the segment from Cat1 Home
- Company XYZ has 500$ in Sales in the segment from Cat1 Men's Clothing
- Company DZA has 200$ in Sales in the segment from Cat1 Beauty
- Company DZA has 200$ in Sales in the segment from Cat1 Home
- Company DZA has 200$ in Sales in the segment from Cat1 Men's Clothing
- Company DZA has 200$ in Sales in the segment from Cat1 Women's Clothing
Find in BOLD the expected OUTPUT
Expected Output:
Brand | Cat1 | Sales Quantity | Sales MS % | Rank by MS % |
---|---|---|---|---|
ABC | Beauty | 1000 | 50% | 1 |
ABC | Home | 300 | 30% | 2 |
ABC | Men's Clothing | 300 | 30% | 2 |
XYZ | Beauty | 800 | 40% | 2 |
XYZ | Home | 500 | 50% | 1 |
XYZ | Men's Clothing | 500 | 50% | 1 |
DZA | Beauty | 200 | 10% | 3 |
DZA | Home | 200 | 20% | 3 |
DZA | Men's Clothing | 200 | 20% | 3 |
DZA | Women's Clothing | 200 | 100% | 1 |
What I need from you?
- The Measure Market Share Volume % is well built? I Want that the measure calculates based in the Cat filtered
MS Volume % = DIVIDE ( CALCULATE ( SUM(FACT_SALES[SALES_QTY] )), CALCULATE ( SUM (FACT_SALES[SALES_QTY] ), ALLEXCEPT (DIM_PRODUCT,DIM_PRODUCT[Cat1],DIM_PRODUCT[Cat2],DIM_PRODUCT[Cat3] ) ),
What could be an example formula to give me what I want? I've tried with RANKX several times, but not seeing the expected results (you can find Rank MS % Measure that i'm trying to build in the link sent)
Any other suggestion to produce a similar output but with another structure?
DUMMY DATA:
Please find in the link [PBI + Dataset] PBI + Dataset
Thank you very much
Diego
powerbi
dataset
dax
analytics
business-intelligence
0 Answers
Your Answer