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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
FPE5
Regular Visitor

Team share % measure (based on variable) changes in scatterplot to total of all rows

Hi guys,

 

I have got a measure that calculates the teamshare % as in example measure and table below.

 

Team Share % =
var PlayerPoints = CALCULATE(sum('Table'[Points]))
var TeamPoints = CALCULATE(sum('Table'[Points]),ALLEXCEPT('Table', 'Table'[Team]))
Return PlayerTarget/TeamTargets

 

 

NameTeamPointsTeam share %
Pete

Red

525%
JohnRed1575%
HankBlue10100%

 

This is all fine, but when I try to get this measure in a scatterplot, with Name as Value and without the Team variable, the Team share % changes and combines all the points from all the Names. So Pete would be 16% (5/30 instead of 5/20).

 

I cant seem to get it to work within a measure. Any tips?

 

Thanks in advance. 🙂

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

Rather than using ALLEXCEPT you can use REMOVEFILTERS and VALUES, e.g.

Team Share % =
VAR PlayerPoints =
    CALCULATE ( SUM ( 'Table'[Points] ) )
VAR TeamPoints =
    CALCULATE (
        SUM ( 'Table'[Points] ),
        REMOVEFILTERS ( 'Table' ),
        VALUES ( 'Table'[Team] )
    )
RETURN
    DIVIDE ( PlayerPoints, TeamPoints )

There's articles about this technique at https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/  and https://www.sqlbi.com/articles/using-allexcept-vs-all-values/ 

View solution in original post

tayloramy
Super User
Super User

Hi @FPE5

 

You’re seeing that because your measure removes all filters except Team, and on the scatter the Team column isn’t on the visual. That means your “team total” quietly becomes the grand total (all Names), so Pete’s share turns into 5/30 instead of 5/20.

Here’s a robust pattern that always re-applies the player’s Team and only removes the Name filter when computing the team total (so page/report filters like Date still apply).

 

Team Share % :=
VAR TeamForName = SELECTEDVALUE('Table'[Team])
VAR PlayerPoints = SUM('Table'[Points])
VAR TeamPoints =
    CALCULATE(
        SUM('Table'[Points]),
        REMOVEFILTERS('Table'[Name]),                -- ignore the current Name only
        KEEPFILTERS('Table'[Team] = TeamForName)     -- force the player’s Team
    )
RETURN
IF ( NOT ISBLANK(TeamForName), DIVIDE(PlayerPoints, TeamPoints) )

Use that measure on your scatter (X or Y), with Name as the category/detail. It will return 25% for Pete even if Team isn’t on the visual.

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

 





If you found this helpful, consider giving some Kudos.
If I answered your question or solved your problem, mark this post as the solution!

Join the Fabric Discord!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
tayloramy
Super User
Super User

Hi @FPE5

 

You’re seeing that because your measure removes all filters except Team, and on the scatter the Team column isn’t on the visual. That means your “team total” quietly becomes the grand total (all Names), so Pete’s share turns into 5/30 instead of 5/20.

Here’s a robust pattern that always re-applies the player’s Team and only removes the Name filter when computing the team total (so page/report filters like Date still apply).

 

Team Share % :=
VAR TeamForName = SELECTEDVALUE('Table'[Team])
VAR PlayerPoints = SUM('Table'[Points])
VAR TeamPoints =
    CALCULATE(
        SUM('Table'[Points]),
        REMOVEFILTERS('Table'[Name]),                -- ignore the current Name only
        KEEPFILTERS('Table'[Team] = TeamForName)     -- force the player’s Team
    )
RETURN
IF ( NOT ISBLANK(TeamForName), DIVIDE(PlayerPoints, TeamPoints) )

Use that measure on your scatter (X or Y), with Name as the category/detail. It will return 25% for Pete even if Team isn’t on the visual.

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

 





If you found this helpful, consider giving some Kudos.
If I answered your question or solved your problem, mark this post as the solution!

Join the Fabric Discord!

Proud to be a Super User!





Hi Tayloramy,

 

Thank you for your reply! 

I've recreated it with some extra fields (which I didnt share like Date), and it works great too. 

 

I'm still a bit puzzled on the use of 

VAR TeamForName = SELECTEDVALUE('Table'[Team])

 and the KEEPFILTERS addition to force the team. So I will read into that as well.

 

Thank you for your help 😄

johnt75
Super User
Super User

Rather than using ALLEXCEPT you can use REMOVEFILTERS and VALUES, e.g.

Team Share % =
VAR PlayerPoints =
    CALCULATE ( SUM ( 'Table'[Points] ) )
VAR TeamPoints =
    CALCULATE (
        SUM ( 'Table'[Points] ),
        REMOVEFILTERS ( 'Table' ),
        VALUES ( 'Table'[Team] )
    )
RETURN
    DIVIDE ( PlayerPoints, TeamPoints )

There's articles about this technique at https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/  and https://www.sqlbi.com/articles/using-allexcept-vs-all-values/ 

Thank you, John!

This worked like a charm. 

Thanks aswell for the two links, im gonna dive into these 🙂

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.