Forum Discussion
What is contiguous selection?
- Anonymous9 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()"
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).
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"?
- Anonymous9 years agoNot 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()"
- gvg9 years agoPost Prodigy
OK, now I understand, why they talk in many threads about having a separate date table! Thanks!
- Anna_O5 years agoFrequent Visitor
Hi! Could you please help me? I created a new calendar table for reference, activated time intelligence, built a relationship between my two tables (calendar table and Sales data dump table), but can't figure out my formula now.
TotalSales LAST YEAR = Calculate([Total Sales],DATEADD('Sales Data Dump'[Posting Date],-1,YEAR))I tried to use my date reference table instead - TotalSales LAST YEAR = Calculate([Total Sales],DATEADD('Calendar Table'[Date],-1,YEAR)) - but it's not working either.My Total Sales are calculated this way:Total Sales = SUM('Sales Data Dump'[Sales Amount (Actual)])I'm missing something... - mandeepmodi2 years agoNew Member
We are facing this issue in those cases when sale of a particular brand was not in previous year but it is in current year. How can we resolve this issue if getting the same error? (Function 'SAMEPERIODLASTYEAR' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion.). Is there any way to define last year value as zero for all those cases where no value exists? I have tried with IFERROR and HASONEVALUE but these are also not working.