Forum Discussion

kenj's avatar
kenj
Frequent Visitor
3 years ago
Solved

dax

I'm Unable to calculate moving/running average using Average Cost moving = AVERAGEX (                                   WINDOW( 1,ABS, 0,REL,                                   SUMMARIZE(ALLSELEC...
  • johnt75's avatar
    3 years ago

    I think the problem is the sort order, you're sorting by month name but I think you want to sort by month number. try

    Average Cost moving =
    AVERAGEX (
        WINDOW (
            1,
            ABS,
            0,
            REL,
            SUMMARIZE (
                ALLSELECTED ( 'Custom Calendar Table' ),
                'Custom Calendar Table'[FY],
                'Custom Calendar Table'[Month Name],
                'Custom Calendar Table'[Month number]
            ),
            ORDERBY ( 'Custom Calendar Table'[FY], ASC,
            'Custom Calendar Table'[Month Number], ASC )
        ),
        [Actual Cost]
    )