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
Anonymous
Not applicable

Problem with Total average of Averagex on rows with weeks for a specific period.

Hello.

 

My problem is that i want to show the total average of an averagex function for all the rows, as i can to use it with color formatting (as a benchmark) -  but I cant seem to figure it out. 
I've tried using the following code:

Total average on rows =
 var _result = 

calculate ( averagex (Values( 'Dim - Date'[W+"WeekNo"]), [measure)] ) , 
FILTER('Dim - Date', [IsLast12Weeks] = "Yes" ), ALL('Dim - Date'[W+"WeekNo"] ) ) 

return 
_result

 My [measure] is a simple count. In the following picture you can see that the Total of the averagex code is the number i want, but on every week (row), so i can compare it to the measure, and color format it.

gugu933_0-1606475886224.png

I hope somebody can help. 

 

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, I guess you want to make the [Total average on rows] display the same amount for each row, which is the average for all weeks, and compare with the [measure], and compare the value with [Measure] then color format it, you can try this measure:

Total average on rows =

calculate ( average ( [measure] ) ,

FILTER(ALL('Dim - Date'), [IsLast12Weeks] = "Yes" ) )

 

To color format the [Measure], you can follow my step:

  1. Create a measure:
Color =

IF([Total average on rows]>=[Measure],"GREEN","RED")
  1. Go to the table chart setting->Conditional formatting->Background color On->Advanced control, and set like this:

v-robertq-msft_0-1606723029798.png

 

And you can get the table like this:

v-robertq-msft_1-1606723029812.png

 

You can download my test pbix file here

More info about Conditional formatting of table chart

 

If this DAX can not achieve your expected result, you can post some sample data(without sensitive data) and your expected result, so that we can help you in advance. Thanks very much!

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, I guess you want to make the [Total average on rows] display the same amount for each row, which is the average for all weeks, and compare with the [measure], and compare the value with [Measure] then color format it, you can try this measure:

Total average on rows =

calculate ( average ( [measure] ) ,

FILTER(ALL('Dim - Date'), [IsLast12Weeks] = "Yes" ) )

 

To color format the [Measure], you can follow my step:

  1. Create a measure:
Color =

IF([Total average on rows]>=[Measure],"GREEN","RED")
  1. Go to the table chart setting->Conditional formatting->Background color On->Advanced control, and set like this:

v-robertq-msft_0-1606723029798.png

 

And you can get the table like this:

v-robertq-msft_1-1606723029812.png

 

You can download my test pbix file here

More info about Conditional formatting of table chart

 

If this DAX can not achieve your expected result, you can post some sample data(without sensitive data) and your expected result, so that we can help you in advance. Thanks very much!

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.