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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rkaushik
Frequent Visitor

Matrix replicating values for all users

Hi,

I am trying to create a matrix using two tables:

Accounts Quota:

Account idUser idQuota
1110
2220

 

Credit:

Account idUser idCredit
1130
1310
2220

These tables have a one to many relationship using account id

I am getting the following matrix after applying dax measures:

Account idUser idQuotaCredit
111030
131010
222020

 

I want to show the matrix like this:

Account idUser idQuotaCredit
111030
13 10
2220

20

 

As you can see, user 3 doesn't have a quota for account 1 but is still showing quota value. The quota is replicating value for all users in an account even if the user doesn't have one. How can I show the result to be like my result table?

 

Here's the dax measure I am using for quota:

Quota value =
CALCULATE(
    SUM('Account Quota'[quota])
)
I am guessing I need to make modifications to the quota measure so that it displays quota only for the matching user value and show blanks for the ones which don't have a user value in accounts quota table.
 
Please let me know if I need to provide more information
3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@rkaushik See attached PBIX below signature.

Quota Measure = 
    VAR __Account = MAX('Credit'[Account id])
    VAR __User = MAX('Credit'[User id])
    VAR __Result = MAXX(FILTER('Accounts Quota', [Account id] = __Account && [User id] = __User), [Quota])
RETURN
    __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hey @Greg_Deckler thanks for your help.
This did help me but I noticed another issue. If in credits table, the account exists but user doesn't exist then it is not showing the account altogether. For example, 

accounts quota table:

accountuserquota
3450

 

credit table:

account iduser idcredit
3  

 

Then I am not seeing account 3 at all in my result matrix. Would you happen to know how I can fix that? I would still like to see:

account iduser idquotacredit
3450  

@rkaushik I recommend that you merge your 2 tables in Power Query like this:

let
    Source = Table.NestedJoin(#"Accounts Quota", {"Account id"}, Credit, {"Account id"}, "Credit", JoinKind.LeftOuter),
    #"Expanded Credit" = Table.ExpandTableColumn(Source, "Credit", {"Credit"}, {"Credit.Credit"})
in
    #"Expanded Credit"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.