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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors