Forum Discussion

Mekist's avatar
Mekist
Helper III
1 year ago
Solved

Sliding Average

Hello I want to make a sliding average as I gave the example below, I created the ratios with a measure   Dönem Oran % Ortalama Formül 2025/03 11,04% 9,06% =ORTALAMA($K5:K$13) 202...
  • Nasif_Azam's avatar
    1 year ago

    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