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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
xmperali
Regular Visitor

Measure to display related country budget

 

Below is Budget Allocations table to see ,how much Countries budget is allocated to state and there by cities and how much budget is remained.(giving background) because sum of all states budget is not equal to countries budget
and sum of all cities budget is not equal to state budget.

My question , i want to create a measure in PowerBI, so that when i filter using country name it should show related country budget. Could you please help me in creating measure.

Business key is CityName

CountryNameCountry BudgetStateNameState BudgetCityNameCityBudget
A10A18A114
A10A18A214
B20B118B1118
C20C120C1120
D30D130D1110
D30D130D2110
D30D130D3110

 

1 ACCEPTED SOLUTION
technolog
Super User
Super User

Given the structure of your table, you can create a measure using the DAX function SUMX combined with the DISTINCT function to ensure you're not summing up the same country's budget multiple times.

Here's a DAX measure that should do the trick:

Country Budget Measure =
SUMX(
DISTINCT('Budget Allocations'[CountryName]),
CALCULATE(SUM('Budget Allocations'[Country Budget]))
)
This measure works by first creating a distinct list of country names (so each country is only considered once) and then, for each country, it sums up the country budget. When you apply a filter on the country name, this measure will show the budget for that specific country.

View solution in original post

1 REPLY 1
technolog
Super User
Super User

Given the structure of your table, you can create a measure using the DAX function SUMX combined with the DISTINCT function to ensure you're not summing up the same country's budget multiple times.

Here's a DAX measure that should do the trick:

Country Budget Measure =
SUMX(
DISTINCT('Budget Allocations'[CountryName]),
CALCULATE(SUM('Budget Allocations'[Country Budget]))
)
This measure works by first creating a distinct list of country names (so each country is only considered once) and then, for each country, it sums up the country budget. When you apply a filter on the country name, this measure will show the budget for that specific country.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.