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
nesisekasi
New Member

Measure that sums different columns as values based on filter

I am trying to create a measure which sums values of different columns based on filter. Say I have 2 tables:

Currency table

CurrencyCode
USD
EUR

 

Sales table

RevenueUSDRevenueEUR
109
5047

 

I need to create a measure that would SUM the revenue from appropriate column when Currency table is applied as filter (i.e. when it's set as USD - measure sums RevenueUSD column, when it's set as EUR - measure sums RevenueEUR column). Is there any way to achieve this?

 

Thanks for help

1 ACCEPTED SOLUTION
pradeep08
New Member

Hello @nesisekasi,

Please find the below solution that works. Also, please note this will work only for Single Selection in the Filter:

pradeep08_0-1688998875664.pngpradeep08_1-1688998895140.png

Here is the formula for the measure:

DynamicRevenue_Sum =
-- Creating variables for each sum
VAR USD_SUM = SUM(Sales[Revenue_USD])
VAR EUR_SUM = SUM(Sales[Revenue_EUR])
-- Identifying Selected Value from the filter
VAR SelectedFilter = SELECTEDVALUE('Currency'[CurrencyCode])
RETURN
-- Returning sum value based on the selection
IF(SelectedFilter = "USD", USD_SUM, EUR_SUM)


Please mark this as solution if it helps.
Thank you,

Pradeep Chowdavarapu
"Even if no one believes you can,

YOU GOT TO BELIEVE YOU CAN."

View solution in original post

1 REPLY 1
pradeep08
New Member

Hello @nesisekasi,

Please find the below solution that works. Also, please note this will work only for Single Selection in the Filter:

pradeep08_0-1688998875664.pngpradeep08_1-1688998895140.png

Here is the formula for the measure:

DynamicRevenue_Sum =
-- Creating variables for each sum
VAR USD_SUM = SUM(Sales[Revenue_USD])
VAR EUR_SUM = SUM(Sales[Revenue_EUR])
-- Identifying Selected Value from the filter
VAR SelectedFilter = SELECTEDVALUE('Currency'[CurrencyCode])
RETURN
-- Returning sum value based on the selection
IF(SelectedFilter = "USD", USD_SUM, EUR_SUM)


Please mark this as solution if it helps.
Thank you,

Pradeep Chowdavarapu
"Even if no one believes you can,

YOU GOT TO BELIEVE YOU CAN."

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.

Top Kudoed Authors