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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mikemi
Frequent Visitor

DAX relative date filtering

I am looking to create two relative date measures for the same field "Gross": Last 30 Days, and Quarter-To-Date.

I created a quick measure but unsure how to filter for the two relative dates above. The end goal is to create a table that shows "Gross" created in the last 30 days, and quarter-to-date (which I don't believe can be done without two separate measures if I want to include them in the same table).

 

Below is the quick measure where I was only able to select one date. I assume the IN { DATE(2018, 4, 27) section is the chunk that needs to be replaced.

 

Gross for Friday, April 27, 2018 = 
CALCULATE(
	SUM('Opportunity'[Gross]),
	'Opportunity'[Created Date] IN { DATE(2018, 4, 27) }
)

 

10 REPLIES 10
Ashish_Mathur
Super User
Super User

Hi,

 

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks, @Ashish_Mathur.

 

I have the file ready to upload but not sure how to share as a link. Suggestions?

Hi,

 

Upload the file to OneDrive/Google Drive and share the download link here.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

Try this measure

 

=CALCULATE(SUM('Opportunity'[Gross]),DATESBETWEEN(DateKey[Date],MIN(DateKey[Date])-30,MIN(DateKey[Date])))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Great measure ! Works for me as well 🙂 Thanks

Thanks! That works for last 30 days. How would quarter-to-date work?

Hi,

 

Try this measure for QTD

 

=CALCULATE(SUM('Opportunity'[Gross]),DATESBETWEEN(DateKey[Date],EDATE(MIN(DateKey[Date]),-3),MIN(DateKey[Date])))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Now neither are working - both measures are the DAX you mentioned. Thoughts?

 

Last_30_Days_QTD_Measures.png

Hi,

 

Create a slicer and drag the Date column from the DateKey table.  Select any specific date there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors