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

Wrong Total from SAMEPERIODLASTYEAR metric in table

Hi!

I've built a simple table with Date (10 rows, one per day), CY Impressions, LY Impressions and % Delta CY vs LY. 

The figures I get for every day are right, but when I include the last available day I have data available for in CY, the Total of LY Impressions at the bottom is completely wrong.

 

I am filtering the table with Date slicer (if that helps), and I only get the correct LY Total amount when only one day is in the table. But as I request two or more days, the LY Total is wrong...

 

The DAX I used to create the Measures: 

CY Impressions = sum(searchanalytics_query[Impressions])
LY Impressions = CALCULATE(SUM([Impressions]),SAMEPERIODLASTYEAR('Date'[Date]))
 
Any idea around this?
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks!

I finally made it: my dates table was based off this measure: 

 

Date = ALLNOBLANKROW ( searchanalytics_query[Date] )

 

and I've changed it by: 

 

Date = CALENDARAUTO()
 
It seems to work ok now. 

Thanks for your help anyways, appreciate it.
 

View solution in original post

4 REPLIES 4
themistoklis
Community Champion
Community Champion

@Anonymous

 

Try to put ALLEXCEPTand see if it works

 

LY Impressions = CALCULATE(SUM([Impressions]), SAMEPERIODLASTYEAR('Date'[Date]), AllExcept('Date', 'Date'[Date]))
Anonymous
Not applicable

Thanks @themistoklis, but unfortunately it didn't work.

 

I wish I could upload images here, but this tool doesn't seem to work very well...

 

 

 

 

 

@Anonymous

 

Clear the cache of your browser and then you will be able to upload the images.

Also if you could share the file with us that would be great.

 

Mask any sensitive data

Anonymous
Not applicable

Thanks!

I finally made it: my dates table was based off this measure: 

 

Date = ALLNOBLANKROW ( searchanalytics_query[Date] )

 

and I've changed it by: 

 

Date = CALENDARAUTO()
 
It seems to work ok now. 

Thanks for your help anyways, appreciate it.
 

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.