Forum Discussion

pippo80's avatar
pippo80
New Member
9 years ago
Solved

Naming specific dates for filtering afterwards

Hi there,   I  would ike to creat a column naming specific date ranges in order to create a filter afterwards. Right now I have set up the follwing IF-statement but it is rather a long formula, spe...
  • pmhoang94's avatar
    9 years ago

    Hi pippo80,

    I can use measure:

    Date Range = IF([DimDate] >= DATE(2017;06;22) && [DimDate] <= DATE(2017;06;28);"22.-28.06";"")))))))
  • v-ljerr-msft's avatar
    9 years ago

    Hi pippo80,

     

    You can also use the SWITCH function to add a date range column to you table in this scenario. The formula below is for your reference. :smileyhappy:

    Date Range =
    SWITCH (
        TRUE ();
        [DimDate] >= DATE ( 2017; 07; 22 ) && [DimDate] <= DATE ( 2017; 07; 25 ); "22.-28.07"; // Just need add a new condition row to add more weekly periods
        [DimDate] >= DATE ( 2017; 06; 22 ) && [DimDate] <= DATE ( 2017; 06; 28 ); "22.-28.06";
        "others"
    )

     

    Regards