cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cbutler
Helper III
Helper III

How to get a group total from a single filtered value?

 How can I get the filtered value of a group from a single value? 
I am looking at pupil numbers by school (individual school code) and the schools locality (multiple schools per locality/catchment)

 

Heres a cut of my data (.Total Pupils is a measure)
pupil numbers by school and locality.PNG

 

I am displaying the number of pupils by school in a bar chart, then the sum of pupils by locality/catchment on a shape map, listing the total by school and locality/catchment 
0.1.PNG

 

When I select a locality/catchment on the map this filters the report correctly, filtering all the schools and the total number of pupils in that locality/catchement
0.2.PNG

 

When I filter the bar chart I would like to disaplay the total number of pupils in the selected school, but the total for the locality/catchment, buut I cant workout the DAX to do this....at the mo it just displays the total for the selected school 😞

0.3.PNG
My display label is working but I cant calculate the total for the selected locality, can anyone help? 

I tried all sorts to get this working but I am abviously missing something. 
 

1 ACCEPTED SOLUTION
Fowmy
Super User IV
Super User IV

@Cbutler 

The following measure will show you the total for the locality of the school coded selected:

Locality Total = 
var __local = SELECTEDVALUE(Table[Locality]) return
CALCULATE(
    [Total Pupil],
    Table[Locality] = __local,
    ALL(Table[School Code])
)

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Blog - Data Visualization

Website   YouTube    LinkedIn   PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User IV
Super User IV

@Cbutler 

The following measure will show you the total for the locality of the school coded selected:

Locality Total = 
var __local = SELECTEDVALUE(Table[Locality]) return
CALCULATE(
    [Total Pupil],
    Table[Locality] = __local,
    ALL(Table[School Code])
)

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Blog - Data Visualization

Website   YouTube    LinkedIn   PBI User Group

View solution in original post

Brilliant thanks! thats got it! Thanks you so much! 
0.14.PNG

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors