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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Dynamic total with sum and average

Dear All,

 

i am using a Matric in Power BI desktop and i have data like below

johnbasha33_0-1627831055046.png

I know how to dynamically manipulate the grand total as average.

 

but here i need total column of Uk with sum and other rows with average.

 

could you please help me out with logic?

refer to this link for more.

https://docs.google.com/spreadsheets/d/1ZJz1XlfpGcnBzaiC070lAfJpjy2_1VhRcj541EcHNSo/edit?usp=sharing

@amitchandak @Pragati11 

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Picture1.png

 

UK sum and others avg : =
IF (
HASONEVALUE ( Countries[Country] ),
SWITCH (
SELECTEDVALUE ( Countries[Country] ),
"UK", SUM ( Data[Value] ),
AVERAGE ( Data[Value] )
)
)

 

 

Link to the sample pbix file 

 

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

@Jihwan_Kim  i mean what if i have states, cities and county level drill down fields in the matrix? the same measure will work for the low granularity level values?

Hi,

Thank you for your feedback.

Can you share your sample pbix file? I think it depends on how your model looks like, and also it depends on how the countries - states - cities are related.

 

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

@Jihwan_Kim  thnaks for valuable time in looking into this issue.

i dint understand your question.

 

country will be linked to state and state will be linked to city.

when we expand the country in matrix, there will be states appear in that case our DAX measure we wrote for country how it will be impact the state level data in the same matrix?

Anonymous
Not applicable

will this work if i add more sub categories in the matrix?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.