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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sayali_deshmukh
Helper III
Helper III

Calculated Column for previous date values

Hi,

Have a table as per below - 

Capture.PNG

Need help for calculating yesterday's actual and day before yesterday's actual using DAX.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@sayali_deshmukh 

You can create measure like with date calendar

Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))

2 Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Day))

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

View solution in original post

Hi @sayali_deshmukh,

 

Would you please refer to the following calculated column:

Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-1)



Day Before Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-2)

Best Regards,

Dedmon Dai

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@sayali_deshmukh 

You can create measure like with date calendar

Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))

2 Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Day))

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

Hi @amitchandak 

Thanks for your help.

Could you suggest a way for text inputs as well ?

 

Capture2.PNG

Hi @sayali_deshmukh,

 

Would you please refer to the following calculated column:

Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-1)



Day Before Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-2)

Best Regards,

Dedmon Dai

Hi @v-deddai1-msft 

Is there any way to extend this solution to calculate previous dates update continuously so that all updates can be gotten as -

Today's update, yesterday's update, day before yesterday's update and so on...

- without creating the columns 

Hi @v-deddai1-msft 

Thanks for your help.

I was able to get the columns as per your inputs.

For that prefer to have column like this

maxx(filter(table,table[task]=earlier(table[task]) && table[Date]=earlier(table[Date])-1),[Todays Plan])

 

Or try the same formula(provided in last update) with Max function and text column

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors