Forum Discussion

vincentakatoh's avatar
vincentakatoh
Icon for Helper IV rankHelper IV
8 years ago
Solved

DAX: 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"...
  • MFelix's avatar
    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