Forum Discussion
Power Bi Challenge - Round1
- 2 years ago
My submission is attached.
(Edited to hack the sort order to match specifications.)
tamerj1
here is my thought on this, correct me if i am wrong.
we can modify the data model or use DAX measures to dynamically reorder the brands based on the user's selection. Here's how you can do it:
> Ensure that your data model includes a table for "Brands" and establish a relationship with your sales data table.
> Create measures to calculate sales amounts for the selected brands. We'll also create a measure to dynamically rank the selected brands based on the user's selection. Here's an example of how you can create these measures:
```dax
Sales Amount = SUM('Sales'[SalesAmount])
Selected Brand 1 Sales = CALCULATE([Sales Amount], 'Brands'[Brand] = SELECTEDVALUE('Brands1'[Brand]))
Selected Brand 2 Sales = CALCULATE([Sales Amount], 'Brands'[Brand] = SELECTEDVALUE('Brands2'[Brand]))
Selected Brand 3 Sales = CALCULATE([Sales Amount], 'Brands'[Brand] = SELECTEDVALUE('Brands3'[Brand]))
Brand Order =
SWITCH (
SELECTEDVALUE ( 'Brands'[Brand] ),
SELECTEDVALUE ( 'Brands1'[Brand] ), 1,
SELECTEDVALUE ( 'Brands2'[Brand] ), 2,
SELECTEDVALUE ( 'Brands3'[Brand] ), 3
)
```
> Create a matrix visual in Power BI. Add "Store" to rows and "Brand" to columns. Add the selected measure (e.g., "Sales Amount") to values. Sort the "Brand" column by the "Brand Order" measure.
> Use a card visual to display the selected brand names dynamically. Create a measure for each brand name like this:
```dax
Selected Brand 1 Name = SELECTEDVALUE('Brands1'[Brand])
```
Repeat this for each selected brand. Then place these measures in separate cards in your report.
> **Dynamic Percentage Difference Display**: Similarly, create measures for each percentage difference as described in the previous response.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Good job johnbasha33 !
But you have to apply this solution to the sample file to make sure it is working as intended without major issues. Looking forward to receive your working solution!