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
Lwpro
Frequent Visitor

Average of the last 7 days

Hey guys,

I need your help, I'm not able to build a metric in dax that says the following: that takes the last collection of all customers who have records (prices) in the last 7 days and makes an average of these values


Can you help me?


Thank you since

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

Hi @FarhanAhmed ,thanks for the quick reply, I'll add more.

Hi @Lwpro ,

The Table data is shown below:

vzhouwenmsft_0-1711334909538.png

Please follow these steps:
1. Use the following DAX expression to create a measure

Measure = 
VAR _a = TODAY()
VAR _b = _a - 6
RETURN
AVERAGEX(FILTER('Table','Table'[Date] >= _b && 'Table'[Date] <= _a),'Table'[price])

2. Final output

vzhouwenmsft_1-1711334962006.png

vzhouwenmsft_2-1711334973362.png

Best Regards,
Wenbin 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

3 REPLIES 3
v-zhouwen-msft
Community Support
Community Support

Hi @FarhanAhmed ,thanks for the quick reply, I'll add more.

Hi @Lwpro ,

The Table data is shown below:

vzhouwenmsft_0-1711334909538.png

Please follow these steps:
1. Use the following DAX expression to create a measure

Measure = 
VAR _a = TODAY()
VAR _b = _a - 6
RETURN
AVERAGEX(FILTER('Table','Table'[Date] >= _b && 'Table'[Date] <= _a),'Table'[price])

2. Final output

vzhouwenmsft_1-1711334962006.png

vzhouwenmsft_2-1711334973362.png

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

FarhanAhmed
Community Champion
Community Champion

Can you please share sample data and desired output







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




Unfortunately not because it is sensitive data. But the basis is like this:

Lwpro_0-1710868016642.png

 

What I'm trying to create is to take the last dates (most recent) bring the last prices within the 7 days and make an average between them

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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