Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

missing fiscal quarter

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.

error.JPG

https://gofile.io/d/4PHQ3Z 

Any advice is grateful. Thank you

 

1 ACCEPTED 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")

View solution in original post

8 REPLIES 8
jairoaol
Impactful Individual
Impactful Individual

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...

amitchandak
Super User
Super User

@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

Anonymous
Not applicable

@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.

Anonymous
Not applicable

@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




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





ToddChitt
Super User
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.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.