Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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:

 

StoreProductAVG. Price

A

A100
AB110
AC120
BA80
BB90
BC100
CA120
CB130

 

Each combination for Store & Product has its own Parameter Slider.

 

The user input would calculate sales as a measure.

 

Would get you:

 

StoreProductAVG. PricePARAMSales

A

A1003300
AB1102220
AC1201120
BA8000
BB9000
BC10000
CA12000
CB13000

 

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?

 

Spoiler

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

  • 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])

    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you!!!!

       

      amitchandak !!!

       

      This worked perfect!