Skip to main content
cancel
Showing results for 
Search instead 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.

Reply
sebastianqc
Helper I
Helper I

Average by two last week on power query or dax

Hi all ,  I have a question, how can I average the last two fields before the current field? Example:

 

example 1.PNG

 

"Promedio" is a Average  from the fields "S4 : S5" , now from the next one i need calculate the Average  from the fields "S5:S6",how i can calculate this? , im new on Power Bi 

 

Thanks for the replies

 

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

@sebastianqc ,

 

Could you please share some sample data and clairfy more details about your requirement?

 

Regards,

Jimmy Tao

@v-yuta-msft  thanks for you reply

 

 I have the feed  4 columns: semana - vigencia - USD/m3 - CPL/m3  on the Last Table.

I have this Table
 

SemDíaUSD/CLPUSD/m3CLP/m3
29lun-10-jul664,78413,01274.558,36
30lun-17-jul655,28423,95277.801,44
31lun-24-jul649,60439,35285.400,28
32lun-31-jul651,74455,33296.751,79
33lun-07-ago649,37450,7882292.728,33
34lun-14-ago646,63445,41288.015,63
35lun-21-ago642,18452,10290.324,78

My problem starts here, since as I said in the header I have to feed 4 columns in power query with tables and columns from previous table; which are:

 

Semana, the order of a week should be shown without repeating as shown in the 3rd table "Sem"

Vigencia, must show the Thursday day of each of the corresponding weeks, associated to "Dia" from the 3rd Table

Parid_sem (USD / m3), must show the average of the last two weeks of the USD / m3 field in table number 3, example: for week 31 you must average the USD / m3 of weeks 29 and 30 of table 3 for week 32 you must average the USD / m3 of weeks 30 and 31 of table 3 and so respectively.

Parid (CLP / m3), and the last table is the average of the last two values ​​(CLP / m3) of table number three, the same as the previous example, but from the CLP / m3 column.

 

thanks for help me

amitchandak
Super User
Super User

I did not completely.

But you can last 14 days /2 weeks using

Rolling 14 day = CALCULATE(Average(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-14,Day))  

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

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

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.