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
mikelee1701
Helper III
Helper III

Changing an aggregate on a column depending on a filter

Hi,

 

My data table is something like this:

 

Datetypevalue
8-3-2022average10
8-5-2022sum4
8-6-2022average6
8-7-2022sum4

 

I have a slicer on type where you can choose between average and sum

 

in my visual, when I filter by average I'd like my visual to show 8

when I filter by sum, i'd like my visual to show 8

 

but what I can't figure out is, in the visuals, I am limited by only choosing one aggregate.   Can I get around this?

 

Screenshot_090622_073844_PM.jpg

 

Thanks in advance.

Mike

1 ACCEPTED SOLUTION
mikelee1701
Helper III
Helper III

I guess it helps to take a break and come back:

I figured out how to do it.

I created a measure:

Mod-Value = SWITCH(max(table[type]),
"average", AVERAGE(AvailResp[Value]),
"sum", SUM(AvailResp[Value])
)

 

 

PS. Looking back at my question, I poorly choose my numbers where the end result is the same answer; which may cause confusion.

 

I should have choose numbers such sum of 50 and 50, is 100

and average of 10 and 6, is 8

 

regardless, I figured it out, and it appears to be working., thanks for reading.

 

 

View solution in original post

3 REPLIES 3
mikelee1701
Helper III
Helper III

I guess it helps to take a break and come back:

I figured out how to do it.

I created a measure:

Mod-Value = SWITCH(max(table[type]),
"average", AVERAGE(AvailResp[Value]),
"sum", SUM(AvailResp[Value])
)

 

 

PS. Looking back at my question, I poorly choose my numbers where the end result is the same answer; which may cause confusion.

 

I should have choose numbers such sum of 50 and 50, is 100

and average of 10 and 6, is 8

 

regardless, I figured it out, and it appears to be working., thanks for reading.

 

 

ryan_mayu
Super User
Super User

@mikelee1701 

should average be 16 or 13?

pls check the attachment to see if this is what you want.

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Average should be 8.   (10+6 = 16, 16/2=8)

 

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.