Forum Discussion
vincentakatoh
Helper IV
8 years agoDAX: IF, Filter, Datesbetween
Hi, Trying to add new column such that IF datesbetween (2017,9,11), (2017,9,15)= "Proto1" IF datesbetween (2017,9,18), (2017,9,22)= "Proto2" IF datesbetween (2017,9,25), (2017,9,29)= "Proto3"...
- 8 years ago
Hi vincentakatoh,
Try the following formula:
Proto = SWITCH ( TRUE (), 'Calendar'[Date] >= DATE ( 2017, 9, 11 ) && 'Calendar'[Date] <= DATE ( 2017, 9, 15 ), "Proto1", 'Calendar'[Date] >= DATE ( 2017, 9, 18 ) && 'Calendar'[Date] <= DATE ( 2017, 9, 22 ), "Proto2", 'Calendar'[Date] >= DATE ( 2017, 9, 25 ) && 'Calendar'[Date] <= DATE ( 2017, 9, 29 ), "Proto3", BLANK () )Regards,
MFelix
MFelix
Super User
8 years agoHi vincentakatoh,
Try the following formula:
Proto =
SWITCH (
TRUE (),
'Calendar'[Date] >= DATE ( 2017, 9, 11 )
&& 'Calendar'[Date] <= DATE ( 2017, 9, 15 ), "Proto1",
'Calendar'[Date] >= DATE ( 2017, 9, 18 )
&& 'Calendar'[Date] <= DATE ( 2017, 9, 22 ), "Proto2",
'Calendar'[Date] >= DATE ( 2017, 9, 25 )
&& 'Calendar'[Date] <= DATE ( 2017, 9, 29 ), "Proto3",
BLANK ()
)Regards,
MFelix
vincentakatoh
Helper IV
8 years agoWorks great. Thanks for introducing the "SWITCH" function. very useful function indeed.
Rgds, Vincent