Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am receiving a "only works with contigous data selections" when using the SAMEPERIODLASTYEAR function, and can't seem to figure out what is causing it. Varous google searches seem to always suggest making sure all dates are there and a 1 to many relationship, which I do have.
I have a calendar table that is complete with no gaps or duplicates. That calender table is actually being made via power query like such:
let
//StartDate = #date(2019,1,1),
StartDate = Date.FromText(Number.ToText(StartYear) & "0101"),
EndDate = Date.AddMonths(StartDate,60),
//EndDate = List.Max(PSData[Date]),
NumberOfDays = Duration.Days(EndDate-StartDate)+1,
DatesList = List.Dates(StartDate, NumberOfDays, #duration(1,0,0,0)),
// Convert the list of dates to a table
CalendarTable = Table.FromList(DatesList, Splitter.SplitByNothing(), {"Date"}, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(CalendarTable,{{"Date", type date}}),
#"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([Date]), Int64.Type),
#"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month", each Date.Month([Date]), Int64.Type),
#"Inserted Quarter" = Table.AddColumn(#"Inserted Month", "Quarter", each Date.QuarterOfYear([Date]), Int64.Type),
#"Inserted Day of Week" = Table.AddColumn(#"Inserted Quarter", "Day of Week", each Date.DayOfWeek([Date]), Int64.Type),
#"Inserted Day Name" = Table.AddColumn(#"Inserted Day of Week", "Day Name", each Date.DayOfWeekName([Date]), type text),
#"Inserted End of Month" = Table.AddColumn(#"Inserted Day Name", "End of Month", each Date.EndOfMonth([Date]), type date),
#"Inserted Day of Year" = Table.AddColumn(#"Inserted End of Month", "Day of Year", each Date.DayOfYear([Date]), Int64.Type),
#"Inserted Week of Year" = Table.AddColumn(#"Inserted Day of Year", "Week of Year", each Date.WeekOfYear([Date]), Int64.Type)
in
#"Inserted Week of Year"
My Calendar table has a 1 to many relationship to a data table.
And my DAX measures trying to compute the YTD Variance between this year and last year.
YTD Amount:=TOTALYTD (
[Amount],
'Calendar'[Date],
"12/31"
)
YTD Amt Var to LY:=[YTD Amount] -
CALCULATE (
[YTD Amount], SAMEPERIODLASTYEAR('Calendar'[Date]
)
)
And when I try to use the YTD Amt measure with a filtered date of January to November (excluding Dec), I get the contiguous date error message?
Solved! Go to Solution.
@ptmuldoon You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
Well, very strange.
I ended up just deleting and redoing the relationship. And then a refresh of data, and it worked.
@ptmuldoon You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
78 | |
58 | |
36 | |
33 |
User | Count |
---|---|
93 | |
59 | |
58 | |
49 | |
42 |