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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
thepuzzlemaster
Frequent Visitor

Matrix Rows - Related table showing all values, rather than just the related one

I have 2 related tables (1: many from Users[userId] -> Homes[ownerId]):
Users:

usersId  name  email  
123john smith  john@smith.com
124becky rileybecky@riley.com


Homes:

ownerId homeId  capacity
12312
12324
12436

 

I also have a 3rd related table (1:many from Homes[homeId] -> Availability[homeId])

homeId  datedate: month
112/12/202212/01/2022
101/10/2023  01/01/2023
101/12/202301/12/2023
201/10/202310/01/2023

 

I have created a matrix, and I want to display the email address associated with a specific owner, but instead it is showing me every owner's email address under each ownerId when I also include the availability data.

I added the following under rows:
Homes[ownerId],
Users[email],
Homes[homeId],

And the following under Values:
Homes[capacity]

I see the following as expected:

ownerId  emailhomeId  capacity
123john@smith.com  12
  24
124becky@riley.com36

 

But if I put Availability[date: month] on columns and a measure which aggregates the availability data on values I get:

ownerId  emailhomeId  December 2022  January 2023
123john@smith.com  112
  201
 becky@riley.com112
  201
124john@smith.com300
 becky@riley.com300

 

If I remove the Users[email] from rows I get the expected result:

ownerId  homeId  December 2022  January 2023
123112
 201
124300

 

 

I imagine there is just some fundamential misunderstanding I have about something here. But I'm confused as to why the inclusion of that aggregated measure would cause the data displayed in the rows to get all wonky.

Thanks!

1 ACCEPTED SOLUTION

Explicit measures require a filter context.  You are trying to report on things that aren't there (gaps in your data).  That requires cross joins and / or disconnected tables. You can also use COALESCE to handle some situations.

 

unavailable/month = COALESCE(DISTINCTCOUNT(Availability[date]), 0)

 

see attached.

 

 

View solution in original post

5 REPLIES 5
lbendlin
Super User
Super User

It is important to carefully choose which column to take from which table. Generally you want to use the higher level dimension colums first.

 

lbendlin_0-1674402474713.png

lbendlin_1-1674402517661.png

 

see attached

 

Thank you so much for the reply. Apologies for not having fully recreated my issue in a similfied pbix that I could share. I forgot an important detail that I didn't realize was necessary here. 

In my actual visual, I am using a measure as my value, not just an aggregation. I've updated your sample .pbix file with a similar measure to my production report, so that it is reproing my issue. I also added some additional users to the users table, since there are some users who may not have a home, to make it match my real data more closely.

It looks like maybe I can't upload a file yet (fairly new to this forum). I am trying to share via google drive.
Hopefully this works. https://drive.google.com/file/d/1B7tX8-r9I9fhfssf4Cccf464jpeoxkjZ/view?usp=sharing

Explicit measures require a filter context.  You are trying to report on things that aren't there (gaps in your data).  That requires cross joins and / or disconnected tables. You can also use COALESCE to handle some situations.

 

unavailable/month = COALESCE(DISTINCTCOUNT(Availability[date]), 0)

 

see attached.

 

 

Thanks again for the reply and the additional context of what is going on here.

What I ended up doing, which gives me the result I want, is to create an additional column (ownerEmail) on my "Homes" table, which uses a merged query to pull in the email address of the owner from the users table. 

The part that is still confusing to me, is given the relationship I set up between Homes[ownerId] and Users[userId], why isn't the visual recognizing the related email field from the user table when the prior row is ownerId and displaying just the related email? Is this specific to the way a matrix works in particular? Is there a term I could search for in order to read up about this for a more in-depth explanation of why the extra column on the Homes table is necessary to get this to work the way I want it to?

search for "auto exist"

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.