cancel
Showing results for
Did you mean:
Helper I

## Average 3 to Average 6 not working

Hi,

I am trying to replicate this measure where I take the average of the ratio from the past 3 months to the past 6 months:

Ratio_Measure 3mth =
VAR DEV_MNT = MAX('PD_agg_perf_measures'[DEV_MONTHS])

VAR NuM = CALCULATE(SUM('PD_agg_perf_measures'[CNP_CNT_ACCOUNTING_VIEW]),FILTER(ALLSELECTED('PD_agg_perf_measures'),[DEV_MONTHS]= DEV_MNT&&[ACCIDENT_DATE_YYYYMM]=MAX('PD_agg_perf_measures'[ACCIDENT_DATE_YYYYMM])))

VAR DEN = CALCULATE(SUM('PD_agg_perf_measures'[CNP_CNT_ACCOUNTING_VIEW]),FILTER(ALLSELECTED('PD_agg_perf_measures'),[DEV_MONTHS]=DEV_MNT-1 &&[ACCIDENT_DATE_YYYYMM]=MAX('PD_agg_perf_measures'[ACCIDENT_DATE_YYYYMM])))

Var Last_Date = LASTDATE('Calendar'[Date])

Return mth_3

I tried to just replace the -3 with -6 for the average of the past 6 months but it is not working. Can someone help me, please?

1 ACCEPTED SOLUTION
Super User

@mluanacruz , You need to have measures like

Monthly Avg like

Rolling 3 = calculate(AverageX(Values('Date'[MONTH Year]), DIVIDE(NuM, DEN,0) ),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

or

Rolling 3 = CALCULATE( DIVIDE(NuM, DEN,0) ,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

from 3 to 6 month

Rolling 3 = CALCULATE( DIVIDE(NuM, DEN,0) ,DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-3) ,-3,MONTH))

Super User

@mluanacruz , You need to have measures like

Monthly Avg like

Rolling 3 = calculate(AverageX(Values('Date'[MONTH Year]), DIVIDE(NuM, DEN,0) ),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

or

Rolling 3 = CALCULATE( DIVIDE(NuM, DEN,0) ,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

from 3 to 6 month

Rolling 3 = CALCULATE( DIVIDE(NuM, DEN,0) ,DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-3) ,-3,MONTH))

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

#### Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors