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
ar_46
Regular Visitor

Aggregate by more than one column with added filter

I have a data set like this with 5 columns:

 

Group,  Color, Serial Number, Month, count

 

I have to find the SUM and AVERAGE , grouped by Group and Color : 

  • Group A - Color
  • Group A- Black & white
  • Group B- Color
  • Group - Black & White

 

The table BI visualization needs to show:

Group , Color , Serial Number, Month, count, Calculated SUM, Calculated AVERAGE

 

I need the following filters on the top

  • Group Filter
  • Color Filter
  • Month Filter

My current measures:

SumValue = CALCULATE(SUM(TestData[Print Count]),ALLSELECTED(TestData),GROUPBY(TestData,TestData[Model Group],TestData[Print Mode]))

 

AvgValue = CALCULATE(AVERAGE(TestData[Print Count]),ALLSELECTED(TestData),GROUPBY(TestData,TestData[Model Group],TestData[Print Mode]))

 

The problem is :

When I display the SUM and AVERAGE in the table view with the rest of the fields:

If I have ALL, ALL , ALL - for group, color and month, the sum and average are the same across group/color combo

If I have group-Selected, color = SELECTED and MONTH = ALL, , the sum and average are the same across group/color combo

 

If I have either group or color selected with MONTH selection, then the sum and averages are no longer the same in the group/color combo.

 

How do I make the group / print filter work with the Month filter to show the same mean for every row in the table ?

 

PS: I need the mean at the table level .

 

Am I missing something ?

 

 

 

 

1 REPLY 1
v-jiascu-msft
Employee
Employee

Hi @ar_46,

 

Can you share a sample and the expected result please? DAX functions will evaluate their contexts. We dont' need to group them in the formula. Maybe the result could be as following.

Group   Color   SUM(count)   AVERAGE(count)

 

Best Regards,

Dale

Community Support Team _ Dale
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.