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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

How to use the treemap to change what is shown on another graph

I have a treemap at the top of my dashboard and using it to filter the rest of the dashboard (it contains Product names). I have a line chart underneath which plots Sales over time. I was wondering if there was a way that if one product is selected from the treemap, the line graph shows SUM([Sales]) but if more than one product or all products are clicked on the treemap it shows AVERAGE([Sales])?

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

I may be oversimplifying your requirement here, but would a measure like this work?

_chartSales =
IF(
  HASONEVALUE([ProductName]),
  SUM([Sales]),
  AVERAGE([Sales])
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @Anonymous ,

 

Sorry for my late reply...

 

According to my understand, if more than one product is selected , then show the average of their values ,otherwise show the sum of the seleced , right?

 

You could use the following formula:

Measure =
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Product Names] ),
        FILTER (
            'Table',
            'Table'[Product Names] IN ALLSELECTED ( 'Table'[Product Names] )
        )
    )
RETURN
    IF ( _count <= 1, SUM ( 'Table'[Value] ), SUM ( 'Table'[Value] ) / _count )

 My final output looks like this:

12.1.4.1.gif

 

Here is the pbix file.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

BA_Pete
Super User
Super User

Hi @Anonymous ,

 

I may be oversimplifying your requirement here, but would a measure like this work?

_chartSales =
IF(
  HASONEVALUE([ProductName]),
  SUM([Sales]),
  AVERAGE([Sales])
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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