Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
hi all...
I have this missing quarter in my table thus having the following error msg. But i am not sure how i should correct it. the same set of data was working fine few months ago until 2020 data was added.
Error Message:
Function 'SAMEPERIODLASTYEAR' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion.
Any advice is grateful. Thank you
Solved! Go to Solution.
@Anonymous , This is one
#"Invoked FunctionSource" = Source(#date(#"Start Year", 1, 1), Duration.Days(DateTime.Date(DateTime.FixedLocalNow()) - #date(#"Start Year",1,1)), #duration(1, 0, 1, 0)),
That should go max of sales or like Date.FromText("2020-12-31")
so that time intelligence functions don't present problems you have to use a date chart
SAMEPERIODLASTYEAR( TABLA_FECHAS(DATE) )
This date table must have all the dates in your fact table. from the oldest date to the present and even future dates.
here's an example of how to create it: https://myprojectserver.wordpress.com/2019/08/12/tabla-de-fechas-en-power-bi-con-festivos-colombia-p...
@Anonymous , I checked You do not have dates after 08-Oct-2020 in the calendar. And you have data after that. I chekced Pbix. Please have additional date in calendar
@amitchandak can I know how do i additional date in existing calendar table
Thank you for helping
@Anonymous , You have stopped your calendar in Power Query till today. Make sure it goes till last date of the fact.
@amitchandak could you explain a little. i didnt know how i stopped the calendar in Power Query till today.
How do i get it to goes till last date of my data which is dec 2020?
thank you
@Anonymous , This is one
#"Invoked FunctionSource" = Source(#date(#"Start Year", 1, 1), Duration.Days(DateTime.Date(DateTime.FixedLocalNow()) - #date(#"Start Year",1,1)), #duration(1, 0, 1, 0)),
That should go max of sales or like Date.FromText("2020-12-31")
Tre this:https://docs.microsoft.com/en-us/dax/calendar-function-dax
My Dates Table = CALENDAR(<start_date>, <end_date>)
Adjust the End Date above to December 31 2020
Proud to be a Super User! | |
Date functions like SAMEPERIODLASTYEAR work best when there is a CONTIGUOUS list of dates. That can't happen if you reference some Date type column in your FACT table. You should create a Date dimension table and join it to the fact table, then when you use the function, it looks like this: SAMEPERIODLASTYEAR('Dates Table'[Date Field])
Hope that helps.
Proud to be a Super User! | |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
96 | |
92 | |
81 | |
70 | |
64 |
User | Count |
---|---|
115 | |
106 | |
96 | |
81 | |
72 |