Forum Discussion
ptmuldoon
1 year agoResolver I
Using variable result in another Variable?
I am trying to use the result of 1 variable into a 2nd variable in computing a value. I know I can do this with nested Switch Statements, but trying to see if this methos would work as well. In...
dharmendars007
1 year agoMemorable Member
Hello ptmuldoon ,
You can try the below code..
Occupied Rooms =
VAR ItemValue =
SWITCH (
VALUES ('Measures List'[Fact Period]),
"Day", [QTY],
"Last 7", [Last 7 QTY],
"MTD", [MTD QTY],
"QTD", [QTD QTY],
"YTD", [YTD QTY])
VAR MyItem =
CALCULATE(ItemValue, 'Dim Item'[description] = "OCCUPIED ROOMS")
RETURN
SWITCH (
VALUES ('FactType'[FactType]),"#", MyItem,"% of Avail. Rooms", DIVIDE( MyItem, CALCULATE([QTY], 'Dim Item'[description] = "AVAILABLE ROOMS") ))
If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!
Thank You
Dharmendar S