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
ls784
Helper I
Helper I

Matrix Totals Incorrect

Hello,

I'm really hoping someone can help me. I'm struggling with a data set and getting a matrix visual totals to display what I need.

I have 3 tables as below (simplified example for data protection). I can’t change my data too drastically, it’s what I’ve been given.

Data:

ls784_1-1760691960196.png

Relationships:

ls784_0-1760692156349.png

 

I'm trying to create a matrix that looks like this with the count of calls for each group, however because Users are in multiple groups/subgroups it's double counting their call count.

ls784_3-1760691960198.png

Therefore I have tried to use a count of how many groups they are in and divide their call count by that, this works for individual lines but the totals and % GT don’t add up.

CallCount =

VAR countcalls = CALCULATE(DISTINCTCOUNT(Calls[CallID]))

RETURN

if ( ISINSCOPE( UserGroups[SubGroup]),

DIVIDE( countcalls , CALCULATE( MAX(UserGroups[Count]), ALLEXCEPT( UserGroups, UserGroups[User])), 0),

countcalls )

 

Any help would be appreciated!

1 ACCEPTED SOLUTION

Hi @ls784,

 

Please try this

 

CallCount =
VAR UniqueUsers =
SUMMARIZE(
UserGroups,
UserGroups[User] -- distinct list of users in current visual context
)
RETURN
SUMX(
UniqueUsers,
VAR CurrentUser = UserGroups[User]
VAR UserCallCount =
CALCULATE(
DISTINCTCOUNT(Calls[CallID]),
FILTER(Calls, Calls[User] = CurrentUser)
)
VAR GroupCount =
CALCULATE(
DISTINCTCOUNT(UserGroups[SubGroup]),
FILTER(UserGroups, UserGroups[User] = CurrentUser)
)
RETURN DIVIDE(UserCallCount, GroupCount, 0)
)

 

if it doesn't work, please share sample data

View solution in original post

10 REPLIES 10
danextian
Super User
Super User

Hi @ls784 

 

What is your expected result, visually, using your sample data? What numbers do you expect to see? If you could  provide that then it would be eaiser for us to come up with a better solution. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi
I *think* this is what I'm expecting to see. I'm not sure if it is possible? I just need the data to make sense as currently it doesn't!

ls784_0-1760699447799.png

 

Hi  @ls784  ,

Thanks for reaching out to the Microsoft fabric community forum.

Please go through the pbix which i shared.

 

 

Regards,
Microsoft Fabric Community Support Team.

Hi @ls784 ,

I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you 

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.   

Best Regards, 
Community Support Team  

Hi @ls784 ,

I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you 

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.   

Best Regards, 
Community Support Team  

grazitti_sapna
Super User
Super User

Hi @ls784,

 

Try below DAX

 

CallCount =
VAR UsersTable =
VALUES(UserGroups[User])
RETURN
SUMX(
UsersTable,
VAR UserCallCount =
CALCULATE(DISTINCTCOUNT(Calls[CallID]), Calls[User] = UserGroups[User])
VAR GroupCount =
CALCULATE(DISTINCTCOUNT(UserGroups[SubGroup]), UserGroups[User] = UserGroups[User])
RETURN DIVIDE(UserCallCount, GroupCount, 0)
)

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

Thank you for your help.
Unfortunately I got an error with this code:

ls784_0-1760694708674.png

 

Ok, got it @ls784 

 

Try this 

 

CallCount =
VAR UsersTable = VALUES(UserGroups[User])
RETURN
SUMX(
UsersTable,
VAR CurrentUser = [User] -- store current user in variable
VAR UserCallCount =
CALCULATE(
DISTINCTCOUNT(Calls[CallID]),
FILTER(Calls, Calls[User] = CurrentUser)
)
VAR GroupCount =
CALCULATE(
DISTINCTCOUNT(UserGroups[SubGroup]),
FILTER(UserGroups, UserGroups[User] = CurrentUser)
)
RETURN DIVIDE(UserCallCount, GroupCount, 0)
)

Unfortunately this doesn't quite give me what I want, the totals don't add up because we can see it's counting the duplicates

ls784_0-1760696536215.png

 

Hi @ls784,

 

Please try this

 

CallCount =
VAR UniqueUsers =
SUMMARIZE(
UserGroups,
UserGroups[User] -- distinct list of users in current visual context
)
RETURN
SUMX(
UniqueUsers,
VAR CurrentUser = UserGroups[User]
VAR UserCallCount =
CALCULATE(
DISTINCTCOUNT(Calls[CallID]),
FILTER(Calls, Calls[User] = CurrentUser)
)
VAR GroupCount =
CALCULATE(
DISTINCTCOUNT(UserGroups[SubGroup]),
FILTER(UserGroups, UserGroups[User] = CurrentUser)
)
RETURN DIVIDE(UserCallCount, GroupCount, 0)
)

 

if it doesn't work, please share sample data

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.