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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ddhingra
New Member

Conditional Formatting With Average of Previous 3 Months

I have month wise Depatrment wise Consumption. Now i  want to take Average of Previos 3 month consumption.

 

In case consumption of current month is more than average of previous 3 months, then i want red sign next to the current month value in my table and in case it is less than the average of previous 3 months, then i want green sign next to the current month value.

 

Sample table below

 

ddhingra_0-1686558279008.png

 

1 REPLY 1
tamerj1
Super User
Super User

Hi @ddhingra 
You can try the following format measure, 1 is green and 0 is red

Formatting Measure =
VAR CurrentConsumption = [Consumption]
VAR Average3MonthsConsumption =
    AVERAGEX (
        TOPN (
            3,
            SUMMARIZE (
                ALLSELECTED ( 'Table' ),
                'Date'[YearMonth],
                "@Consumption", CALCULATE ( [Consumption], ALL ( 'Date'[MonthName] ) )
            ),
            'Date'[YearMonth], ASC
        ),
        [@Consumption]
    )
RETURN
    INT ( Average3MonthsConsumption > CurrentConsumption )

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.