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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Mosquito87
Regular Visitor

3-Month average of a measure

Hi all,

 

I already read a couple of similar threads and spent hours on my own but still not found a suitable DAX solution that works for my problem.

 

I am trying to create a measure [_Ramp-Up_AVG] that calculates a 3m-average based on the distinct monthly values of measure [_Ramp-Up-Month] which is itself a measure that is calculated independently. The measures are calculated as follows:

 

_Total_Claims = CALCULATE(SUM('Field Data'[Quantity:Pareto 1]))
 
_Sales_Cumulated = 
CALCULATE(
    [_CNTRY_TOTALSALES],
    FILTER(
        ALL('DimVisualDates'[VIS_Date]),
        ISONORAFTER('DimVisualDates'[VIS_Date], MAX('DimVisualDates'[VIS_Date]), DESC)))

 

_RampUp_Month = CALCULATE(([_Total_Claims]*12)/[_Sales_Cumulated]*100) --> works fine
 
The following table shows the intended results.
MonatSales[_Sales_Cumulated][_Total_Claims][_Ramp-Up-Month][_Ramp-Up-AVG]
Jan 2120320315,91% 
Feb 2116737000,00% 
Mrz 2120557536,26%4,06%
Apr 2120477934,62%3,63%
Mai 21363114200,00%3,63%
Jun 21396153810,78%1,80%
Jul 213011839127,83%2,87%
Aug 21611245020,98%3,20%
Sep 21117256794,21%4,34%
Okt 21320288720,83%2,01%
Nov 21255314200,00%1,68%
Dez 21277341910,35%0,39%

 

I am having trouble with calculating the correct 3-month average now.

 

Mosquito87_0-1626693287776.png

 

My first approach was to build up [_Ramp-Up_AVG] as follows:

 

_RampUp_AVG = DIVIDE(calculate('Field Data'[_RampUp_Month],DATESINPERIOD(DimVisualDates[VIS_Date],ENDOFMONTH(DimVisualDates[VIS_Date]),-3,MONTH)),3,BLANK())

 

Unfortunately it delivers false results (that do not match with the correct values, see table above).

 

I really appreciate your support. 

 

Best regards

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Mosquito87 ,

You can update the formula of measure [_RampUp_AVG] as below and check whether it can return the correct data in your scenario:

_RampUp_AVG = 
VAR _LastDate =
    LASTDATE ( DimVisualDates[VIS_Date] )
RETURN
    CALCULATE (
        AVERAGEX ( VALUES ( DimVisualDates[Monat] ), [_RampUp_Month] ),
        FILTER (
            ALL ( DimVisualDates ),
            DimVisualDates[VIS_Date] <= _LastDate
                && DimVisualDates[VIS_Date] > DATEADD ( _LastDate, -3, MONTH )
        )
    )

yingyinr_0-1626842956446.png

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Mosquito87 ,

You can update the formula of measure [_RampUp_AVG] as below and check whether it can return the correct data in your scenario:

_RampUp_AVG = 
VAR _LastDate =
    LASTDATE ( DimVisualDates[VIS_Date] )
RETURN
    CALCULATE (
        AVERAGEX ( VALUES ( DimVisualDates[Monat] ), [_RampUp_Month] ),
        FILTER (
            ALL ( DimVisualDates ),
            DimVisualDates[VIS_Date] <= _LastDate
                && DimVisualDates[VIS_Date] > DATEADD ( _LastDate, -3, MONTH )
        )
    )

yingyinr_0-1626842956446.png

Best Regards

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.