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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AJW2023
Regular Visitor

Compare Monthly Totals to Calculated Average and Highlight Values Above using Conditional Formating

I am trying to use a DAX command to identify monthly totals that are above the monthly average and use conditional formating to highlight those which are above the average.  Current commands used:

- Total = SUM(sheet1[Number Sold])

- Average = AVERAGEX(VALUES(Sheet1[Date]),[Total])

 

Have attempted to use:

- Measure = IF([Total]>[Average], "Red", "Green") 

 

However I am not getting the desired result and it does not identify the months where the total is above the monthly average per category.

 

AJW2023_0-1673823714080.png

 

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but please try to fix the AVERAGE MEASURE something like below whether it suits your requirement.

 

Average measure: =
AVERAGEX ( ALLSELECTED ( Sheet1[monthname], Sheet1[monthname_sort] ), [Total] )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


@Jihwan_Kim  that worked to get me the correct average calulation however it is still not working for the measure comparing the monthly totals per category to the average to identify those which are above the average.

 

For example from the original screen shot, for "Site A" the average is 3.67 therefore the months where the number sold were greater than the average = January, Feburary, May, July, August and September and highlight these values Red

Hi,

It is hard to tell without understanding how the data model looks like, but I think, in that case, the average measure has to remove filers that are applied except [Site] column.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Data is very basic:

 

AJW2023_0-1673844279887.png

 

Hi,

Thank you for sharing.

Do you mean something like below?

 

Jihwan_Kim_0-1673854679058.png

 

Jihwan_Kim_1-1673855075393.png

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.