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
Water_question
New Member

Showing results of the last 365 days, using a measure

Hello,

 

I have a data set with water quality measuring results which vary form day tot day.

I am trying to show the results of the last 365 days, starting with the most recent data point, wich may vary, depending on the most recent downloaded data set.

 

I managed to filter for the relative date, for the past 365 days. The problem is that this filter first looks to the present day (e.g. 17-7-2023) but I need it to start from the most recent data point, wich is at 22-6-2023. And starting from 22-6-2023, show the results from the past 365 days.

 

I'm guessing that I first need to make a measure that can determine the most recent result and generate the results of the past 365 days.

 

My question; how can I make such a measure

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Water_question ,

 

I suggest you to try code as below to create a measure.

Data in Last 365 Days = 
VAR _RecentPoint = CALCULATE(MAX('Table'[Date]),ALL('Table'))
VAR _Measure = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Date]>=_RecentPoint-365 && 'Table'[Date]<=_RecentPoint))
RETURN
_Measure

Data in my sample is from 2021/01/01 to 2023/06/22. Result is as below.

vrzhoumsft_0-1689754294198.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @Water_question ,

 

I suggest you to try code as below to create a measure.

Data in Last 365 Days = 
VAR _RecentPoint = CALCULATE(MAX('Table'[Date]),ALL('Table'))
VAR _Measure = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Date]>=_RecentPoint-365 && 'Table'[Date]<=_RecentPoint))
RETURN
_Measure

Data in my sample is from 2021/01/01 to 2023/06/22. Result is as below.

vrzhoumsft_0-1689754294198.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.