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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
TheBIGuy_PBI
Helper II
Helper II

SamePeriodLastYear doesn't seem to be working

Hi, I've been trying to get my SamePeriodLastYear function to work without success.  I must be missing something I'm sure I'll be kicking myself for missing but I can't seem to produce the correct values

Using fake data, in this screen print,  I show august 21 sales data but there should be zero since I have no data for August 2020. I must be missing something in the calculation?
The screen print here shows the example, the data model and what the tables look like

Any help is appreciated.

TheBIGuy_PBI_1-1675350199765.png

 

 

 



1 ACCEPTED SOLUTION
Padycosmos
Solution Sage
Solution Sage

Padycosmos_0-1675352286731.png

                    Instead of this , create a seaparate measure ,

                   Total Sales = SUM(TrackSales[SalesAmt]) and use this measure in                                     CALCULATE

View solution in original post

10 REPLIES 10
TheBIGuy_PBI
Helper II
Helper II

Thanks very much! It worked!

TheBIGuy_PBI
Helper II
Helper II

Hi, I tried it and it wasn't successfull
Here's a screen print

TheBIGuy_PBI_0-1675353259636.png

 




Padycosmos_0-1675356246577.png

Also , the Month and Year in the columns of the Matrix visual, are they from the calendar table? Please ensure that they are from the calendar table

the $ are from the sales table, and all the date related fields are from the calendar table.

I find that the Salesdate column is not of the 'Date' data type. In case the new mwasure does not work, please try changing the data type of Salesdate to 'Date' and try again.

I find that the Salesdate column is not of the 'Date' data type. In case the new measure does not work, please try changing the data type of Salesdate to 'Date' and try again. Please ensure that both the related date columns are of the 'Date'  data type

Hold on.  It does appear that it's working in the detail.  Here's the screen print
So it seems that using the correct date in the column seemed to have done the trick.

TheBIGuy_PBI_0-1675355469131.png


It looks like the detail is working but the total seems to be calculating the results in correctly 

TheBIGuy_PBI_1-1675355659967.png

Wouldn't the totals be equa

TheBIGuy_PBI
Helper II
Helper II

Thank you and I'll try that!

You are welcome. Also I find that the Salesdate column is not of the 'Date' data type. In case the new mwasure does not work, please try changing the data type of Salesdate to 'Date' and try again.

Padycosmos
Solution Sage
Solution Sage

Padycosmos_0-1675352286731.png

                    Instead of this , create a seaparate measure ,

                   Total Sales = SUM(TrackSales[SalesAmt]) and use this measure in                                     CALCULATE

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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