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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

 

Thanks in advance,

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

View solution in original post

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

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

 

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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