Forum Discussion

danb's avatar
danb
Resolver I
8 years ago
Solved

Custom Date Ranges based on Slicer Selection

Hi Experts,    I am trying to create custom date ranges that I will name and then drop into a slicer. Example is the time period 5/21/18 through 7/8/18 would be named C5-2018. 7/9/18 through 9/2/18...
  • drewlewis15's avatar
    8 years ago

    I would expand your campaign table to include all dates within each campaign range.  You could then relate the tables by joining on the newly created date column in your campaign table to the date field in your Sales table.

     

    Start with what you have in your campaign table, and add a custom column with the following statement:

     

    List.Transform({Number.From(Date.From([Start Date]))..Number.From(Date.From([End Date]))}, each Date.From(_))

     

    Then simply expand that list, and you will have every individual date reference a campaign number.  You can then add a slicer to your dashboard with Campaign number, which will then filter your sales table because they are related.

     

    So start with what you have:

     

    Then add the custom column to give you this:

     

    Then join the tables on the Date fields:

     

    Then your output will be: