Forum Discussion
Anonymous
8 years agoNot applicable
IF and SWITCH in measures
I don't have much experience using IF for creating a measure and just stumbled across switch today, but it appears that if I want to create a measure using either, I can only use measures that I've a...
MFelix
Super User
8 years agoHi Anonymous,
Like in any measure the use of columns suppose to have an aggregator to make the comparision so using IF or SWITCH in your measure with a date column you must use a MAX, MIN for example to make the selection within your column and the IF / SWITCH function work properly.
Regards,Felix
Like in any measure the use of columns suppose to have an aggregator to make the comparision so using IF or SWITCH in your measure with a date column you must use a MAX, MIN for example to make the selection within your column and the IF / SWITCH function work properly.
Regards,Felix
Anonymous
8 years agoNot applicable
Yep, that's what smoupre said.
smoupre: here's a sample of the data - the expected Current Locaiton for No. 1 would be (using TODAY() and assuming it's 2/3/2018), would be Acorn Street, for No. 2 it would be Bling Street, for No. 3 it would be High Street, and No. 4 it would be Mountain Street. Is the best option here to create a new column for the current location using the dates?
| No. | Address | New Address | Move Date |
| 1 | Acorn Street | Camp Street | 10/31/2018 |
| 2 | Doe Street | Bling Street | 2/1/2018 |
| 3 | High Street | 1st Street | 8/1/2018 |
| 4 | Car Street | Mountain Street | 1/1/2018 |
- v-jiascu-msft8 years ago
Microsoft Employee
Hi Anonymous,
Please try a measure like this:
Measure = IF ( MIN ( 'Table1'[Move Date] ) > TODAY () || ISBLANK ( MIN ( 'Table1'[Move Date] ) ), MIN ( Table1[Address] ), MIN ( Table1[New Address] ) )Best Regards,
Dale
- Anonymous8 years agoNot applicable
It looks like that worked, thank you so much! I don't (or didn't until now) have any experience with the || (or &&) operators, those look like they will be very helpful going forward, I appreciate it.