cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rcyber Regular Visitor
Regular Visitor

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?2018-01-24_10-34-14.png

 

Thanks in advance,

Alex.

1 ACCEPTED SOLUTION

Accepted Solutions
banurekham Regular Visitor
Regular Visitor

Re: Average Value for Last 3 Days

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)))

View solution in original post

3 REPLIES 3
banurekham Regular Visitor
Regular Visitor

Re: Average Value for Last 3 Days

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)))

View solution in original post

banurekham Regular Visitor
Regular Visitor

Re: Average Value for Last 3 Days

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)))

 

Highlighted
rcyber Regular Visitor
Regular Visitor

Re: Average Value for Last 3 Days

It works fine!

Thank you so much!

 

Alex.

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 6 members 2,577 guests
Please welcome our newest community members: