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
platinum
Regular Visitor

Dateadd formula month to date previous period problem

Hi,

I have some probles with measures for for previous period. I created matrix in wich I look at current year from Jan 1st and every day updating data for yesterday (full day). There is first split  by week then by date in matrix rows.

For curent year it's calculated as it should, but when I calculate for example for period 4 years ago it returns wrong Total at the end of matrix.

Subtotals on a week level are fine, but if you see on the bottom there is total up to 31.01.2019 not to 16.01.2019 because I need to have the same period of 4 years ago.  But if I choose from date slicer for example 15th instead of 16th (yesterday actualy) it works fine. I need somehow to limit measure to use period 4 years ago until yesterday date.

As you see subtotals for weeks in the Total should return 10.553K (01.01.2019-16.01.2019) but it returns 17.979K (01.01.2019-31.01.2019) and that is for whole january of 2019.

platinum_1-1674021687247.png

I used following measures:

Sales current year = SUM(DailySales[Sales_CY])
Sales CY - 4 Dateadd = CALCULATE([Sales current year], DATEADD(DATES[Date], -4, YEAR))
I even try with Parallelperiod but it returns whole year, and it is great for some other ideas 🙂
Sales CY - 4 Parallel period = CALCULATE([Sales current year], PARALLELPERIOD(DATES[Date], -4,YEAR))
 
I have separate DATES lookup table, in which there are split by weeks (Year & Week), and other splits. 
 
I ran through many topics and searching through web but I couldn't find solution. Really tried to do it on myself but without any success.
Any help will be appreciate greatly.
 
Thanks.
Sasha
 

 

 

0 REPLIES 0

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.

Top Solution Authors