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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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