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
yogeshk77
Helper I
Helper I

Moving Average Calculation Difference

I need a help to compare what's causing the difference of output between two identical formulas & how to fix it please.

 

Refer to this OldPBI, whcih is showing a moving average of "last 6 sprints" (Last column) of story points.

This DAX measure is not showing the result as expected.

 

I then copied that single table data to another PBI called NewPBI, and there it's working well.

Can someone please do a quick review of the measures & relationships & suggest me what's causing this difference & How do fix teh OldPBI to show correct moving averages?

 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @yogeshk77 ,

As checked the two pbix files you provided, and in the new file, you get the summary value for the field [Story_Points_10004] directly. In the old file you can also modify the measure [Last 6 Avg] as follows with the similar idea: first get the summary value of each directory, and then get the desired result based on the conditions.

Measure = 
VAR _SUMMARIZE =
    SUMMARIZE (
        ALLSELECTED ( WeightedVel ),
        WeightedVel[Learnosity_Team_10202],
        WeightedVel[Reporting Sprint ID],
        WeightedVel[Reporting Sprint Name],
        "SUMOFSP", CALCULATE ( SUM ( WeightedVel[Story_Points_10004] ) )
    )
VAR _ADDRANK =
    ADDCOLUMNS (
        _SUMMARIZE,
        "RANK",
            RANKX (
                FILTER (
                    _SUMMARIZE,
                    [SUMOFSP] > 0
                        && [Learnosity_Team_10202] = EARLIER ( [Learnosity_Team_10202] )
                ),
                [Reporting Sprint ID],
                ,
                DESC,
                DENSE
            )
    )
VAR _ADDLAST6AVG =
    ADDCOLUMNS (
        _ADDRANK,
        "LAST6AVG",
            IF (
                [RANK] <= 6,
                AVERAGEX (
                    FILTER (
                        _ADDRANK,
                        [Learnosity_Team_10202] = EARLIER ( [Learnosity_Team_10202] )
                            && [RANK] >= EARLIER ( [RANK] )
                            && [RANK]
                                <= EARLIER ( [RANK] ) + 5
                    ),
                    [SUMOFSP]
                )
            )
    )
RETURN
    SUMX (
        FILTER (
            _ADDLAST6AVG,
            [Learnosity_Team_10202] = MAX ( WeightedVel[Learnosity_Team_10202] )
                && [Reporting Sprint ID] = MAX ( WeightedVel[Reporting Sprint ID] )
        ),
        [LAST6AVG]
    )

vyiruanmsft_0-1696840320499.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
yogeshk77
Helper I
Helper I

You are a genius.. Thank you so much !!!

v-yiruan-msft
Community Support
Community Support

Hi @yogeshk77 ,

As checked the two pbix files you provided, and in the new file, you get the summary value for the field [Story_Points_10004] directly. In the old file you can also modify the measure [Last 6 Avg] as follows with the similar idea: first get the summary value of each directory, and then get the desired result based on the conditions.

Measure = 
VAR _SUMMARIZE =
    SUMMARIZE (
        ALLSELECTED ( WeightedVel ),
        WeightedVel[Learnosity_Team_10202],
        WeightedVel[Reporting Sprint ID],
        WeightedVel[Reporting Sprint Name],
        "SUMOFSP", CALCULATE ( SUM ( WeightedVel[Story_Points_10004] ) )
    )
VAR _ADDRANK =
    ADDCOLUMNS (
        _SUMMARIZE,
        "RANK",
            RANKX (
                FILTER (
                    _SUMMARIZE,
                    [SUMOFSP] > 0
                        && [Learnosity_Team_10202] = EARLIER ( [Learnosity_Team_10202] )
                ),
                [Reporting Sprint ID],
                ,
                DESC,
                DENSE
            )
    )
VAR _ADDLAST6AVG =
    ADDCOLUMNS (
        _ADDRANK,
        "LAST6AVG",
            IF (
                [RANK] <= 6,
                AVERAGEX (
                    FILTER (
                        _ADDRANK,
                        [Learnosity_Team_10202] = EARLIER ( [Learnosity_Team_10202] )
                            && [RANK] >= EARLIER ( [RANK] )
                            && [RANK]
                                <= EARLIER ( [RANK] ) + 5
                    ),
                    [SUMOFSP]
                )
            )
    )
RETURN
    SUMX (
        FILTER (
            _ADDLAST6AVG,
            [Learnosity_Team_10202] = MAX ( WeightedVel[Learnosity_Team_10202] )
                && [Reporting Sprint ID] = MAX ( WeightedVel[Reporting Sprint ID] )
        ),
        [LAST6AVG]
    )

vyiruanmsft_0-1696840320499.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.