Forum Discussion
Anonymous
4 years agoNot applicable
VALUES is not retuning correct result inside switch function.
I created a DAX in which I am use values of a slicer and based on that calcuations are happened. but the Values is not returning correct result. PY_test = IF(HASONEVALUE('Time Intelligence'[Pe...
- Anonymous4 years ago
Hi Anonymous .
Use this DAX instead;PY_test =
var a=SELECTEDVALUE(Time Intelligence'[Period]),
SWITCH(
TRUE(),
a = "W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "W"),
a = "4W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "4W"),
a = "12W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "12W"),
a = "52W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "52W")
))
Let me know if that works.
Thanks,
Sanket
If this post helps, then mark it as "Accept as Solution" and give it a thumbs up.
Anonymous
4 years agoNot applicable
Hi Anonymous .
Use this DAX instead;
PY_test =
var a=SELECTEDVALUE(Time Intelligence'[Period]),
SWITCH(
TRUE(),
a = "W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "W"),
a = "4W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "4W"),
a = "12W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "12W"),
a = "52W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "52W")
))
Let me know if that works.
Thanks,
Sanket
If this post helps, then mark it as "Accept as Solution" and give it a thumbs up.
var a=SELECTEDVALUE(Time Intelligence'[Period]),
SWITCH(
TRUE(),
a = "W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "W"),
a = "4W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "4W"),
a = "12W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "12W"),
a = "52W",CALCULATE([Value],'Prior Year'[Name] = "PY",a = "52W")
))
Let me know if that works.
Thanks,
Sanket
If this post helps, then mark it as "Accept as Solution" and give it a thumbs up.