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
hnoori
New Member

Sameperiod last year sales not working with slicers

I have two new measures:

 

BrandQTD = TOTALQTD(sum(Query1[Brand Units]),Query1[Date])

 

and the same formula for last year

 

BrandQTD_LY = CALCULATE([BrandQTD],SAMEPERIODLASTYEAR(Query1[Date]))

 

They work fine but when I use a slicer, the sameperiodlastyear formula gives an error.

 

Power BI Error

1 REPLY 1
Eric_Zhang
Employee
Employee


@hnoori wrote:

I have two new measures:

 

BrandQTD = TOTALQTD(sum(Query1[Brand Units]),Query1[Date])

 

and the same formula for last year

 

BrandQTD_LY = CALCULATE([BrandQTD],SAMEPERIODLASTYEAR(Query1[Date]))

 

They work fine but when I use a slicer, the sameperiodlastyear formula gives an error.

 

Power BI Error


@hnoori

What is in the slicer? Could you post the pbix file? You can upload the pbix file to OneDrive or any web drive and share the download link. Do note to mask sensitive data before uploading.

 

By the way, for those QTD,YTD functions, please use continuous dates by creating a calendar table and then create measures using the calendar table.

BrandQTD_LY = CALCULATE([BrandQTD],SAMEPERIODLASTYEAR(dimdate[Date]))

BrandQTD = TOTALQTD(sum(Query1[Brand Units]),dimdate[Date])

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.