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

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

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.