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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
hemantsingh
Helper V
Helper V

Same Day last year is throwing time contiguos error

HI there,

 

   I am trying to calculate the same period last year over a sales data that has data from 01-04-2013 till 31-01-2016. I am able to get the monthwise sale & running sales for the data but as soon as i am trying to bring the sameperiod last year measure to the matrix visual, i am presented with time contiguos error.

 

Here is what i tried

 

Sales_YTD - Calculate(sales,datesytd(datekey(date))) -- Working good

previousyear sale - calculate(sales,sameperiodlastyear(datekey(date))) --Measure created successfully but throwing error when using.

 

matrix-table.PNGSpyl_Error.PNG

 

Any idea??

5 REPLIES 5

I suspect your error may be from the grand total column at the end. The grand totals are for multiple years, and hence are not contiguous. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

@MattAllington : i didn't understand your suggestion completely. Can you please be more elaborative. Further, Which grand total column you are talking about. There are two column under TOTAL header column. one is for sales total & another one is for ytd running total. is there a way to avoid this total column from showing up in the visual ??

 

Apart from my doubt above, I am stuck on this & not able to proceed further to complete my dashborad. it would be great if you help me in resolving it.

 

regards,

@hemantsingh

 

In DAX, both functions must be based on contiguous date collection. In this scenario, the datesytd() function only evaluates dates within current year. But sameperiodlastyear() function will evaluate the date back to last year. It may have missing date in last year range which makes it not "contiguous". Please check the source data. 

 

Regards,

Sorry, I am not at my PC to test or check (only iPad). Try putting year on the rows in your matrix, and the. Months below that, also on rows. If the error goes away, then that is the problem. You can check the visualisation tools (paint brush) to see if you can run off grand Totals for rows. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

@MattAllington : it worked mate. The moment i put both year & month one below another in rows the error got away.

 

Thanks for guiding me.

 

Regards

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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