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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

50 days Moving Average graph exceeding date values in the column

Hi Team,

This is regarding Moving average measure. we have a date column called short date and values in short date will always be less than or equal to today. But the graph is going beyond today. May be by default it is considering whole calendar year.

 

Formula we used is 

FTE rolling average =

IF(

    ISFILTERED('redmine hyper_automation_program_view'[ShortDate]),

    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),

    VAR __LAST_DATE = LASTDATE('redmine hyper_automation_program_view'[ShortDate].[Date])

    RETURN

        AVERAGEX(

            DATESBETWEEN(

                'redmine hyper_automation_program_view'[ShortDate].[Date],

                DATEADD(__LAST_DATE, -50, DAY),

                __LAST_DATE

            ),

            CALCULATE(SUM('redmine hyper_automation_program_view'[FTE]))

        )

 

The output is:

Rohini_Gande_0-1637906367432.png

Area marked in red should not be appaered in the visual.

 

Thanks in advance!!

 

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

Hi @Anonymous ,

Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.If question still not solved ,could you pls share your sample data,and remember to remove confidential data.

 

Best Regards
Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.If question still not solved ,could you pls share your sample data,and remember to remove confidential data.

 

Best Regards
Lucien

VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this:

 

 

 

FTE rolling average =
VAR __LAST_DATE =
    LASTDATE ( 'redmine hyper_automation_program_view'[ShortDate].[Date] )
RETURN
    IF (
        ISFILTERED ( 'redmine hyper_automation_program_view'[ShortDate] ),
        ERROR ( "Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column." ),
        AVERAGEX (
            FILTER (
                ALL ( 'redmine hyper_automation_program_view' ),
                DATESBETWEEN (
                    'redmine hyper_automation_program_view'[ShortDate].[Date],
                    DATEADD ( __LAST_DATE, -50, DAY ),
                    __LAST_DATE
                )
            ),
            [FTE]
        )
    )

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.