cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Resolver I

## Average Value for Last 3 Days

Hi All!

I'm trying to create measure that will contains average value of Price for previous 3 days.

I have done it in Excel, it is very simple formula.

How can I create a measure in Power BI Desktop for it?

Alex.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

Try the below formula;

Measure = IF(COUNTROWS(DATESINPERIOD(Price[Date],LASTDATE(Price[Date]),-3,DAY))>2,CALCULATE(AVERAGE(Price[Price]),DATESINPERIOD(Price[Date],LASTDATE(Price[Date]),-3,DAY)))

3 REPLIES 3
Anonymous
Not applicable

Hi,

Try the below formula;

Measure = IF(COUNTROWS(DATESINPERIOD(Price[Date],LASTDATE(Price[Date]),-3,DAY))>2,CALCULATE(AVERAGE(Price[Price]),DATESINPERIOD(Price[Date],LASTDATE(Price[Date]),-3,DAY)))

Resolver I

It works fine!

Thank you so much!

Alex.

Anonymous
Not applicable

I created a table Price with fields Date & Price. Added the measure to get the last 3 days average

Measure = IF(COUNTROWS(DATESINPERIOD(Price[Date],LASTDATE(Price[Date]),-3,DAY))>2,CALCULATE(AVERAGE(Price[Price]),DATESINPERIOD(Price[Date],LASTDATE(Price[Date]),-3,DAY)))

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors