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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Mekist
Helper III
Helper III

Sliding Average

Hello

I want to make a sliding average as I gave the example below, I created the ratios with a measure

 

DönemOran %OrtalamaFormül
2025/0311,04%9,06%=ORTALAMA($K5:K$13)
2024/124,30%8,81%=ORTALAMA($K6:K$13)
2024/0919,58%9,45%=ORTALAMA($K7:K$13)
2024/0624,10%7,76%=ORTALAMA($K8:K$13)
2024/0313,08%4,50%=ORTALAMA($K9:K$13)
2023/129,11%2,35%=ORTALAMA($K10:K$13)
2023/0925,37%0,10%=ORTALAMA($K11:K$13)
2023/06-22,78%-12,54%=ORTALAMA($K12:K$13)
2023/03-2,30%-2,30%=ORTALAMA($K13:K$13)
1 ACCEPTED SOLUTION
Nasif_Azam
Super User
Super User

Hey @Mekist ,

The goal is to make Sliding Average with DAX (Matching Excel’s =AVERAGE(Kx:K13) Pattern). You are creating a sliding (or rolling) average in DAX where the average should be calculated from the current row down to the last row.

 

DAX Formula (Sliding Average from Current to Last Row)

SlidingAverage :=
VAR CurrentPeriod = 'YourTable'[Dönem]
RETURN
AVERAGEX(
    FILTER(
        ALL('YourTable'),
        'YourTable'[Dönem] >= CurrentPeriod
    ),
    'YourTable'[Oran]
)

 Things to remember:

  • Make sure Dönem is sorted descendingly (newest to oldest), matching how your Excel table flows.

  • If Oran is text (e.g., % formatted string), first convert it to a number in Power BI or Power Query.

  • Use ALL('YourTable') to avoid existing filter context interfering with the sliding window.

 

If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


Best Regards,
Nasif Azam



Did I answer your question?
If so, mark my post as a solution!
Also consider helping someone else in the forums!

Proud to be a Super User!


LinkedIn

View solution in original post

3 REPLIES 3
Nasif_Azam
Super User
Super User

Hey @Mekist ,

The goal is to make Sliding Average with DAX (Matching Excel’s =AVERAGE(Kx:K13) Pattern). You are creating a sliding (or rolling) average in DAX where the average should be calculated from the current row down to the last row.

 

DAX Formula (Sliding Average from Current to Last Row)

SlidingAverage :=
VAR CurrentPeriod = 'YourTable'[Dönem]
RETURN
AVERAGEX(
    FILTER(
        ALL('YourTable'),
        'YourTable'[Dönem] >= CurrentPeriod
    ),
    'YourTable'[Oran]
)

 Things to remember:

  • Make sure Dönem is sorted descendingly (newest to oldest), matching how your Excel table flows.

  • If Oran is text (e.g., % formatted string), first convert it to a number in Power BI or Power Query.

  • Use ALL('YourTable') to avoid existing filter context interfering with the sliding window.

 

If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


Best Regards,
Nasif Azam



Did I answer your question?
If so, mark my post as a solution!
Also consider helping someone else in the forums!

Proud to be a Super User!


LinkedIn

Hello @Nasif_Azam 

Thank you, my problem has been solved in general Without data in the last two periods, he did not make calculations As in the example, when there is no vieri, it does not calculate in all periods

 

DönemOran %Ortalama
2025/0311,04% 
2024/124,30% 
2024/0919,58% 
2024/0624,10% 
2024/0313,08% 
2023/129,11% 
2023/0925,37% 
2023/06  
2023/03  

I have excluded those who do not have period data as follows, I wanted to share it in case there is a need

Satış Büyüme (Kümüle) Ortalama = 

VAR GuncelDonem = MAX('Dönem'[Dönem])
VAR Donemler = 
    FILTER(
        ALL('Dönem'[Dönem]),
        'Dönem'[Dönem] <= GuncelDonem
    )
RETURN
AVERAGEX(
    Donemler,
    CALCULATE([Satış Değişim-Kümüle])
)

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors