Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi all,
Looking to calculate two values based off of another column.
Example:
I want to calculate the sales of shop1 and shop2 but only if it is in New York.
| ID | City | Shop1Sales | Shop2Sales | 
| 1 | New York | 40 | 30 | 
| 2 | Chicago | 20 | 35 | 
| 3 | New York | 50 | 10 | 
| 4 | Chicago | 10 | 10 | 
So the result should be in a new column:
TotalNewYorkSales
70
0
60
0
Any help appreciated.
Solved! Go to Solution.
I encourage you to unpivot your data, but, if not, you can try use this measure expression
NY Sales = CALCULATE(SUMX(Table, Table[Shop1Sales] + Table[Shop2Sales]), KEEPFILTERS(Table[City] = "New York")) + 0
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I encourage you to unpivot your data, but, if not, you can try use this measure expression
NY Sales = CALCULATE(SUMX(Table, Table[Shop1Sales] + Table[Shop2Sales]), KEEPFILTERS(Table[City] = "New York")) + 0
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
