Forum Discussion
switch measure dax
- 3 years ago
Hi,
I have finally done it. Don't know why but it works
What i did was duplicate my date (DD/MM/YYYY hh:mm:ss) column and covert it into Date Only (DD/MM/YYYY)
Below is my formula
Mins in a day = SWITCH(TRUE(),SELECTEDVALUE('Measure Selection'[Measure Name])="Sheffield" && SELECTEDVALUE(Date[Date_Only])<DATE(2022, 10, 18), 440,SELECTEDVALUE('Measure Selection'[Measure Name])="Sheffield" && SELECTEDVALUE(Date[Date_Only])>=DATE(2022, 10, 18), 600,1440)
f1rich Unable to replicate this behavior. Where is the Date column coming from? From your Date table or from your fact table? Could be that if coming from fact table that if the relationship is one direction then the filtering is not flowing back. See attached PBIX for my attempt to replicate. Below signature.
Hi Greg,
Thanks for your PBIX, this works but needs another filter to pick Sheffield only. I have a measure name which looks at Sheffield, Bradford, York etc. Is there any way i can do this? All are from one table be the way.
Thank you
- f1rich3 years agoFrequent Visitor
Hi,
I have finally done it. Don't know why but it works
What i did was duplicate my date (DD/MM/YYYY hh:mm:ss) column and covert it into Date Only (DD/MM/YYYY)
Below is my formula
Mins in a day = SWITCH(TRUE(),SELECTEDVALUE('Measure Selection'[Measure Name])="Sheffield" && SELECTEDVALUE(Date[Date_Only])<DATE(2022, 10, 18), 440,SELECTEDVALUE('Measure Selection'[Measure Name])="Sheffield" && SELECTEDVALUE(Date[Date_Only])>=DATE(2022, 10, 18), 600,1440)