Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello
Say I have a table with three columns - Shop Name, City Name and Fruit Sold.
Shop Name City Name Fruit Sold
Fruit Galore Antwerp 137
Fruit Fest London 245
Fresh Fruit London 567
Fruit n Veg Paris 231
Fruit House Antwerp 668
I want to display the sum of Fruit Sold per City Name in a measure within a visual that also has the Shop Name in it (but NOT the City Name). There is also no City Name slicer on the tab.
So the visual would look like
Shop Name Fruit Sold
Fruit Galore 805
Fruit Fest 812
Fresh Fruit 812
Fruit n Veg 231
Fruit House 805
This is simple if City Name is included in the visual or is slicing the visual from outside.
But what I can't work out is how to have Fruit Sold by City Name in a measure WITHOUT City Name also being in the visual or slicing the visual from outside.
Any help much appreciated.
Solved! Go to Solution.
Hi @Tom_G ,
The chief issue is that there is a row level filter on 'Shop Name'. Once we remove that, we would be able to aggregate based on 'City'.
Give this a try!
FruitSoldMeasure =
VAR city = SELECTEDVALUE(FruitSales[City Name])
RETURN CALCULATE(
SUM(FruitSales[Fruit Sold]),
REMOVEFILTERS(FruitSales[Shop Name]),
FruitSales[City Name] = city
)
Hi @Tom_G ,
The chief issue is that there is a row level filter on 'Shop Name'. Once we remove that, we would be able to aggregate based on 'City'.
Give this a try!
FruitSoldMeasure =
VAR city = SELECTEDVALUE(FruitSales[City Name])
RETURN CALCULATE(
SUM(FruitSales[Fruit Sold]),
REMOVEFILTERS(FruitSales[Shop Name]),
FruitSales[City Name] = city
)
Hi @sathya_s - thanks for the measure! It seems to work well. I notice there are slight changes in the behaviour of this measure vs the ALLEXCEPT one below, which relates to responsiveness of the measure to other slicers on the tab, which I didn't mention. ALLSELECTED is more responsive to those other slicers than ALLEXCEPT. I will check this in detail and let you know the result. Thanks again!
Hi @sathya_s I checked and in fact both the ALLSELECTED and ALLEXCEPT versions work for the problem specified. ALLSELECTED works better to have responsiveness to any other slicers on the tab, ALLEXCEPT works better if you don't want that responsiveness. So I marked both as solutions. Thanks to you and @amitchandak for the help.
@Tom_G , If that is sum, how is different from a visual having only shop name
If that avg it can make diff
averageX(Values(Table[City]), calculate(sum(Table[Fruit Sold])) )
Hi @amitchandak thanks for the response.
The measure you provided gives me the fruit sold per shop name, not the fruit sold per city on each shop line.
This is the closest I have below, (as you can see there are a couple of other columns explained below that also feature). The below is not working correctly in some specific cases and i'm not sure why exactly. Maybe you know?
Fruit sold per city = VAR _CITY = MAX('Table'[City])
Thanks
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.