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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
LeoQ
Helper I
Helper I

Averages with small multiples charts

Hi everybody! I have been trying to solve this for days, but I couldn't find a solution.
I have a measure that calculates the average amount of mails answered by agents for day. With that information I created a small multiples chart, as shown in the image below. There I show how many mails each agent answered the last days to compare.

 

Example.png

 

 

What I need is to apply a conditional color to each column, according to wether the mails answered by each agent that day, is above or below the average of mail answered by agent that day.
For example the average number of mails annswered by agent the 27th was 11,09, so the columns of each agent for that day should be red if the number is lower than 11,09 or green if it's greater.

 

I tried with calculated tables and other kind of measures, but they always filter by agent in each bar chart and doesn´t take the total average for day.

Thanks a lot!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @LeoQ ,

You can create a measure as below to get it, please find all the details in the attachment.

Conditonal formatting = 
VAR _averageofperday =
    CALCULATE (
        AVERAGE ( 'Table'[Value] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Date] = SELECTEDVALUE ( 'Table'[Date] )
        )
    )
VAR _averageofperagent =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Date] = SELECTEDVALUE ( 'Table'[Date] )
                && 'Table'[AGENT] = SELECTEDVALUE ( 'Table'[AGENT] )
        )
    )
RETURN
    IF ( _averageofperagent < _averageofperday, "red", "green" )

yingyinr_0-1631086194941.png

Best Regards

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @LeoQ ,

You can create a measure as below to get it, please find all the details in the attachment.

Conditonal formatting = 
VAR _averageofperday =
    CALCULATE (
        AVERAGE ( 'Table'[Value] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Date] = SELECTEDVALUE ( 'Table'[Date] )
        )
    )
VAR _averageofperagent =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Date] = SELECTEDVALUE ( 'Table'[Date] )
                && 'Table'[AGENT] = SELECTEDVALUE ( 'Table'[AGENT] )
        )
    )
RETURN
    IF ( _averageofperagent < _averageofperday, "red", "green" )

yingyinr_0-1631086194941.png

Best Regards

It worked perfectly. Thanks a lot for your time!!

mahoneypat
Microsoft Employee
Microsoft Employee

You likely need an expression like this for your bar color.

 

BarColor =
VAR vThisAgent = [YourAgentDayAvgMeasure]
VAR vAllAgents =
    CALCULATE ( [YourAgentDayAvgMeasure], ALLSELECTED ( Table[Agent] ) )
RETURN
    IF ( vThisAgent > vAllAgents"Green""Red" )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi, thanks for your time. The problem is that I need to compare the absolute amount of mails answered per day per agent, but compare it with the average of all agents in the same day. I tried your formula, but it color all the columns the same.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors