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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
btalahmbong
Advocate II
Advocate II

Create Column with Last 3 Months

Hi,

 

I have a date column and I am trying to create a calculated column that contains the dates from current date and shifts back 3 months. So far I noticed it is possible to use DATESBETWEEN or DATESINPERIOD in a CALCULATE function but they can't be used independently which is what I am trying to do. Is there a way I can do this? Here's the dax code I had for my calculated column;

 

Last3Months = DATESINPERIOD('All Stations'[Date],TODAY(), -3,MONTH)

 

Here's the error I get;

 

A table of multiple values was supplied where a single value was expected.

 

Thanks for your help.

 

3 REPLIES 3
Datatouille
Solution Sage
Solution Sage

Hi @btalahmbong

 

DatesBetween and DatesinPeriod both return tables and not a scalar value.

As a result, you cannot use the functions "alone' (except when using DAX as a query language to create new tables) in measures or calculated columns.

But you can use these tables as filter arguments to Calculate yes.

For example, this measure:

 

SalesLast3Month = Calculate ([Total Sales],DATESINPERIOD('All Stations'[Date],TODAY(), -3,MONTH))

 returns the total sales of the last three months.

Measures automatically adapt to filter context and make your calculations dynamic!

@btalahmbong

 

Any updates on your question ?

 

For now, I'm creating new measures filtered by last 3 months. I'll keep on playing with it and see if I can find a way to create a column that acts as a 3 monh filter.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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