Forum Discussion

gvg's avatar
gvg
Post Prodigy
9 years ago
Solved

What is contiguous selection?

Some functions only work with "contiguous selections". What are they exactly? For example, 

 

Function 'SAMEPERIODLASTYEAR' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion. And what is meant here "date column is not unique"?

 

  • Anonymous's avatar
    Anonymous
    9 years ago

    Right, but it's not a big deal :)   You need to create a separate date table, then relate your current table, to the date table.

     

    Probably the easiest way is to use New Table in the Modeling ribbon, and type "Dates = CALENDARAUTO()"

     

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    All of the time intelligence functions require a date table (more like a date column) as a parameter.  That date column has to include every date (say, incluing weekends and holidays) with no "gaps".  That is what is meant by continguous (which, sounds similiar to "continuous").

     

    Some weird things can happen though, if you are trying to use these time intelligence functions like SAMEPERIODLASTYEAR... if you use a slicer to remove rows from the middle.   Same period last year wants to look at just exactly 1 "period" -- that can be a week, day, month, 4.6 weeks... but they need to be 1 continuous range not like "the 1st and 4th week of July" (which would have a gap... in the 2nd and 3rd weeks, and is not allowed).

     

     

     

    • gvg's avatar
      gvg
      Post Prodigy

      Does that mean that I cannot use time intelligence functions for a data set like this:

       

      Date          Sales
      2016-01-01    100
      2016-01-04     80
      2016-01-20    200
      2017-01-02     60
      2017-01-05     40
      2017-01-21     20

       

      I.e. I will not be able to compare January-2016 to January-2017 because dates are not "contiguous"?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Right, but it's not a big deal :)   You need to create a separate date table, then relate your current table, to the date table.

         

        Probably the easiest way is to use New Table in the Modeling ribbon, and type "Dates = CALENDARAUTO()"