Forum Discussion
9 + Parameters, Dax function if two column Variables match!
Writing as a DAX newbie!
I am trying to use 9 Parameters (What if) user inputs to change a measured calculate.
The idea is simple, if there are two variables, like the table below:
| Store | Product | AVG. Price |
A | A | 100 |
| A | B | 110 |
| A | C | 120 |
| B | A | 80 |
| B | B | 90 |
| B | C | 100 |
| C | A | 120 |
| C | B | 130 |
Each combination for Store & Product has its own Parameter Slider.
The user input would calculate sales as a measure.
Would get you:
| Store | Product | AVG. Price | PARAM | Sales |
A | A | 100 | 3 | 300 |
| A | B | 110 | 2 | 220 |
| A | C | 120 | 1 | 120 |
| B | A | 80 | 0 | 0 |
| B | B | 90 | 0 | 0 |
| B | C | 100 | 0 | 0 |
| C | A | 120 | 0 | 0 |
| C | B | 130 | 0 | 0 |
I am unable to post the PBIX file, but I have put some of my original thoughts below!
I am not able to get DAX to work, as i am still learning the functions.
1. What would be the best practice for this exercise?
2. Would you be able to provide a DAX example for this provided example?
I have tried to create a measure that calculates profit for store A Products 1-3 using the params to the left.
Originally starting with DAX (not familiar)
IF(
SELECTEDVALUE('Table'[Store])="A" && SELECTEDVALUE('Table'[Product])="A",
SELECTEDVALUE('Store A _ Product A'[Store A _ Product A])*
SELECTEDVALUE('Table'[Average Price]),
0)
The Idea is to change the amount sold for the 9 variations using user inputs!
Anonymous , Try a measure like
Switch(True() ,
max(Table[Store]) = "A" && max(Table[Product]) = "A", average(Table[AVG. Price])* selectedvalue(Table[param1])
max(Table[Store]) = "A" && max(Table[Product]) = "B", average(Table[AVG. Price])* selectedvalue(Table[param2])
max(Table[Store]) = "A" && max(Table[Product]) = "C", average(Table[AVG. Price])* selectedvalue(Table[param3]))
2 Replies
- amitchandakSuper User
Anonymous , Try a measure like
Switch(True() ,
max(Table[Store]) = "A" && max(Table[Product]) = "A", average(Table[AVG. Price])* selectedvalue(Table[param1])
max(Table[Store]) = "A" && max(Table[Product]) = "B", average(Table[AVG. Price])* selectedvalue(Table[param2])
max(Table[Store]) = "A" && max(Table[Product]) = "C", average(Table[AVG. Price])* selectedvalue(Table[param3]))
- AnonymousNot applicable