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
jpt1228
Responsive Resident
Responsive Resident

Compare value from 364 days ago

Hello, I have data that is reported every 28 days or 13 times per year. I need to compare the current value with the previous value from last year (reported 364 days prior). Since the calendar dates are not the same: 5/21/2017 VS 5/22/2016 I can't compare months or the week in the year because some of the weeks fall on different weeks in the year. I think I need to calculate the current date which in this case is 5/21/2017 and compare that value to the one reported on 5/22/2016. Since the data is reported every 28 days I just need to take the MAX date and the date from 364 days before.

 

I have a DIMdate table and fact table. The fact table is sturucture with a customer, TDP value, and date.

 

image.png

 

Desired Result Based on the MAX date to always show the most up to date. Current data would be 5/22/17 VS 5/22/17-364 days. The next data release would update to show 6/18/2017 and then the value from 6/19/2016 (364 days before)

 

CustomerTDP LYTDP TYTDP CHG
Customer A1401466
Customer B52154120

 

I tried this formula but it doesn't bring in the value I am looking for.

 

LY TDP = CALCULATE(SUM(TDP[TDP]),
   DATEADD(DIMDate[Date],-364,DAY))

 

4 REPLIES 4
OpenDataLab
Helper II
Helper II

The easiest way I have found to do this is by adding a day overall number, basically a unique row id 1,2,3,4,5 etc....I use this to navigate back a froward through my date range.

 

LY TDP =
CALCULATE (
    SUM ( TDP[TDP] ),
    FILTER (
        ALL ( 'Date' ),
        'Date'[Day Over All]
            = MAX ( 'Date'[Day Over All] ) - 364
    )
)

Hi @OpenDataLab - Are you saying bring in the day of the year for each date in the DateDim 1-365 not including a leap year?

 

Thanks

No.  Just add an identity field that keeps on going from the first day of your date dimension until the last day. e.g if your date dimension had 2 years worth of data then you would hve values from 1 through to 728.

 

 

 

I have multiple dates for multiple customers. Im pretty new to PoweerBI. Would this be an index column of the DimDate table? This is a sample of my source table. I have transformed the Time Description into an actual date.

 

Time DescriptionGeographyBrandTDP
Quad End 2015-Aug-16TOTAL US - SPECIALTY GOURMET CHANNELCompany A117
Quad End 2015-Aug-16TOTAL US - MULOCompany A19
Quad End 2015-Aug-16TOTAL US - NATURAL CHANNELCompany B14
Quad End 2015-Aug-16TOTAL US - MULOCompany B1
Quad End 2015-Aug-16TOTAL US - SPECIALTY GOURMET CHANNELCompany C5
Quad End 2015-Aug-16TOTAL US - MULOCompany C2
Quad End 2015-Dec-06TOTAL US - SPECIALTY GOURMET CHANNELCompany A118
Quad End 2015-Dec-06TOTAL US - MULOCompany A20
Quad End 2015-Dec-06TOTAL US - NATURAL CHANNELCompany B18
Quad End 2015-Dec-06TOTAL US - MULOCompany B0
Quad End 2015-Dec-06TOTAL US - SPECIALTY GOURMET CHANNELCompany C5
Quad End 2015-Dec-06TOTAL US - MULOCompany C2
Quad End 2015-Jul-19TOTAL US - SPECIALTY GOURMET CHANNELCompany A116
Quad End 2015-Jul-19TOTAL US - MULOCompany A18
Quad End 2015-Jul-19TOTAL US - NATURAL CHANNELCompany B16
Quad End 2015-Jul-19TOTAL US - MULOCompany B1
Quad End 2015-Jul-19TOTAL US - SPECIALTY GOURMET CHANNELCompany C5
Quad End 2015-Jul-19TOTAL US - MULOCompany C2
Quad End 2015-Nov-08TOTAL US - SPECIALTY GOURMET CHANNELCompany A117

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.