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

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

Reply

How to write DAX query for getting last 30 days from a column not from Date table

Hi, I have a requirement, where I need the last 30 days data based on a date column that is not from Date table.

My DAX query is : 

 

Medium_Resolution_Timestamp =
Var ART=calculate(AVERAGE(Source[MinutesRoundTotal]),filter(source,Source[Priority]="Medium"),DATESINPERIOD(Source[Resolved At].[Date],TODAY(),-30,DAY),'Calendar'[WeekDay- Weekend]="Weekday")
Var Result=if(isblank(Res),"No Data Available" & UNICHAR ( 10 ) &"Data displayed is: last 30 days since" & " (" & (today()-30) &")"& ". Priority is: Medium ",FORMAT(Res,"HH:MM" )& UNICHAR ( 10 ) & UNICHAR ( 10 ) & "HH:MM")
Return UNICHAR(10)
& Result
 
My requirement is to find the last 30 days avg resolution time with reference to 'Resolved At ' column. (Consider Resolved At date and find last 30 days data. For example, I need to find the data from 4/20 to5/20 baed on Resolved At column)
 
Please let me know if I can use DatesinPeriod for this .
 
Thanks,
Radhika Lanka
1 ACCEPTED SOLUTION
jeroendekker
Frequent Visitor

Hi
Dates in Period should reference a full data column in your Calendar. 

I guess something like this.


DATESINPERIOD
 ( Calender[Date], LASTDATE(Source[Resolved At])-30DAY )

I hope this helps.

 

P.s It helps If you format your DAX. Try www.daxformatter.com for tips.

View solution in original post

2 REPLIES 2

Thank you for all the responses. I am able to resolve the issue.

jeroendekker
Frequent Visitor

Hi
Dates in Period should reference a full data column in your Calendar. 

I guess something like this.


DATESINPERIOD
 ( Calender[Date], LASTDATE(Source[Resolved At])-30DAY )

I hope this helps.

 

P.s It helps If you format your DAX. Try www.daxformatter.com for tips.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.