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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
RishabSajith
Frequent Visitor

Issue with the DAX with data model in Power BI - Distinct Count

Hello,

 

I have run into the following issue in power BI, im still a beginner using Power BI:

I have 3 tables, 1 is deal table which includes all the information about the deal such ( number of bedrooms, washrooms, priceof the property,type of property, etc. ), next table is deal_users which includes all the information about the commission earned by the user for a particular deal and users table which includes the information of all the users. Currently the data model is as seen below:

RishabSajith_0-1764844663506.png

Following is the relatonship between the tables:

1. many-to-one relationship between deal_id (deal_user) and id (deals)

2. many-to-one relationship between user_id(deals) and id (users)

3. one-to-many relationship between id(users) and user_id(deal_users) ( inactive )

 

However, I can only see the gross commission for some of the deals that happened, but I cant see the deal value which is Deal Value = SUM('newcrm_prod bixo_deals'[price]) for some deals only, even though the Ids match between the tables:

RishabSajith_2-1764845092988.png

But the Ids are present in both deals and deal_users, following is the check I did manually in deal_user table using:

RishabSajith_3-1764845265195.png

 

The DAX formula for all the calculations are as follows:

Number of Deals = DISTINCTCOUNT('newcrm_prod bixo_deal_user'[deal_id])
Deal Value = SUM('newcrm_prod bixo_deals'[price])
Gross Commission (Active User Relationship) =
CALCULATE(
    SUM('newcrm_prod bixo_deal_user'[total_amount]),
    USERELATIONSHIP(
        'newcrm_prod bixo_deal_user'[user_id],
        'newcrm_prod users'[id]
    )
)

 

What is the issue here? Am I missing something? Can someone help me with the same as I can see that these Ids exist is both the tables with the same data types as well as without any hidden characters.

 

Thanks in advance.

1 ACCEPTED SOLUTION

@RishabSajith ,

, User table should join Either with Deal or Deal/User, not both.

Possible join

User-> Deal -> Deal user.

I can see both deal ID and user ID in deal and deal user, then there should be a composite key and a join be like

user -> deal user -> Deal

Deal user and Deal can many to many and Deal user filter Deal

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

8 REPLIES 8
ajaybabuinturi
Resident Rockstar
Resident Rockstar

Hi @RishabSajith,

Wanted to let you know your relatinship creates a problem. 

When you put a field from deal_user (example: deal_user[deal_id]) in a visual:

  • Power BI filters deal_user
  • That filter cannot travel backward to deals (because the active direction goes only from deals → deal_user, not the reverse)

Can you try to mdify the Deal Value measure as below and let me know.

Deal Value =
CALCULATE(
    SUM('newcrm_prod bixo_deals'[price]),
    CROSSFILTER(
        'newcrm_prod bixo_deal_user'[deal_id],
        'newcrm_prod bixo_deals'[id],
        BOTH)
)

 

Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

Hello ,

 

This solution does not seem to work.

RishabSajith
Frequent Visitor

Hello @FBergamaschi ,

 

Unfortunately I cannot share the whole PBIX with you as it contains sensitive information, however this is the entire data model with the corrected names I mentioned:

RishabSajith_1-1764847806782.png

 

Hope this helps.

The user table has too many relationships: 

 

Users -> Deals -> Deal User

 

User -> Deal User

 

You need only one of these in place at a time, amybe changing it according to your needs

 

Without the pbix I cannot do more, unfortunately that give you rough suggestions

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

@RishabSajith ,

, User table should join Either with Deal or Deal/User, not both.

Possible join

User-> Deal -> Deal user.

I can see both deal ID and user ID in deal and deal user, then there should be a composite key and a join be like

user -> deal user -> Deal

Deal user and Deal can many to many and Deal user filter Deal

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak ,

Thanks for the help.

 

This helps to an extend, however I when I add "ref" which is the unique identifier in the deals table, it seems to be pulling all the "ref" which are not a part of the filter as well.

 

RishabSajith_0-1764848521569.png

 

Following is what is there in this Matrix table:

RishabSajith_1-1764848554456.png

 

 

Just tried it again, this seems to work!

Thank you!

FBergamaschi
Super User
Super User

The picture you show is only part of a bigger data model and the table names are not the ones you cite, so it is a bit confusing. We need to see the entire data model to see other relationships that might cause the issue.

 

That said, can you share the pbix so I fix the issue? It is impossible other wise to help you

 

If you can, please send it with a private message (and inform me you did answering here)

 

Thanks

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

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.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.