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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
shubhamc_002
Helper I
Helper I

Get previous Time period data in calculated column | DAX

Hi Team,

We have 3 columns Date, Product, Amount in our table.  Our requirement is to calculate new column which should have amount of product last 1 year back and each row should have last one yaer of amount. We should not use Sameperiodlast year since time frame is not exactly 1 years back.

 

Date   Product    Amount    Previous Year amount

D1     P1           Val1                VAL300

D2     P1           Val2                VAL301

.       .

.       .

.       . 

.       .

.       .

D300  P1         Val300
D301  P1         VAL301

 

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @shubhamc_002 ,

 

Based on your description, please try:

Previous Year amount = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Product]=EARLIER('Table'[Product]) && 'Table'[Date] =EARLIER('Table'[Date])+299))

vcgaomsft_0-1691550910010.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @shubhamc_002 ,

 

Based on your description, please try:

Previous Year amount = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Product]=EARLIER('Table'[Product]) && 'Table'[Date] =EARLIER('Table'[Date])+299))

vcgaomsft_0-1691550910010.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

amitchandak
Super User
Super User

@shubhamc_002 , Then how far is last year. Say you need Week Year behind - 364 Days. You can have measure like

 

week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.