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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
abyars
Frequent Visitor

SAMEPERIODLASTYEAR() not adding correctly

 
3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @abyars ,

 

Has your problem been solved? If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out. Thanks in advance.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

abyars
Frequent Visitor

I have also figured out that the grand total is correct, but after the first subtotal, the subtotals are all incorrect.

Hi @abyars ,

 

Here are some suggestions:

- Make sure you have a proper date table that is marked as date in the model view and has a one-to-many relationship with your fact table. You can use the CALENDAR() or CALENDARAUTO() functions to create a date table.
- Try using the DATEADD() function instead of SAMEPERIODLASTYEAR() to shift the dates by one year.

- Check if your date column has any gaps or missing values that might affect the calculation of SAMEPERIODLASTYEAR(). You can use the ISBLANK() function to identify any blank values and replace them with appropriate values.
- If you are using a slicer or filter to select a specific time period, make sure it is applied to both the current year and the previous year measures. You can use the ALLSELECTED() function to remove filters from a column while retaining any filters from slicers or other visuals.

 

In order to better understand your demands and give the right solution, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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