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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Data model issue: Any way to link N:N that have NULLS as well?

Hey guys,

 

I have an issue related to my datamodel. 

 

 

What I want to reach is to SUM the RENTMAX.AmountRentMax and RENTLOSS.AmountRentLoss in a Bar Diagram next to each other, and I want to filter those two amounts simultaneously by the OBJECT.Type and OBJECT.Color.

 

The beginning is very simple:

Table OBJECT 1:n Table CONTRACTOBJECT via key ObjectID

Table CONTRACTOBJECT 1:n Table CONTRACT via key RentalObjectID

Table CONTRACT 1:n Table RENTMAX via key ContractID

However, I cannot seem to join the last table RENTLOSS

 

This is because not every ContractID has an AccountNum

And I know not every AccountNum has a ContractID.

On top of that some AccountNum have multiple ContractID's.

So it's clearly a N:N relationship.

 

Below is some example data that I want to connect to each other.

 

OBJECT
ObjectIDTypeColor
12Blue
22Green
31Blue
41Red
51Blue

 

 

CONTRACTOBJECT
RentalObjectIDObjectID 
12 
23 
34 
44 

 

CONTRACT
ContractIDRentalObjectIDAccountNum
111
212
32NULL
434
544
615
726
836
947
1048

 

RENTMAX
ContractIDAmountRentMaxPeriodEnd
1400Saturday 31 March 2018
2200Saturday 31 March 2018
3400Saturday 31 March 2018
4400Saturday 31 March 2018
5300Saturday 31 March 2018
6300Saturday 31 March 2018
7400Saturday 31 March 2018
8400Saturday 31 March 2018
10300Saturday 31 March 2018
1500Wednesday 28 February 2018
2300Wednesday 28 February 2018
3500Wednesday 28 February 2018
4500Wednesday 28 February 2018
5300Wednesday 28 February 2018
6300Wednesday 28 February 2018
7500Wednesday 28 February 2018
8500Wednesday 28 February 2018
10600Wednesday 28 February 2018

 

RENTLOSS
AccountNumAmountRentLossPeriodEnd
1400Saturday 31 March 2018
2200Saturday 31 March 2018
4400Saturday 31 March 2018
5300Saturday 31 March 2018
6300Saturday 31 March 2018
7400Saturday 31 March 2018
11400Saturday 31 March 2018
12400Saturday 31 March 2018
1500Wednesday 28 February 2018
2300Wednesday 28 February 2018
4500Wednesday 28 February 2018
5300Wednesday 28 February 2018
6300Wednesday 28 February 2018
7500Wednesday 28 February 2018
11500Wednesday 28 February 2018
12500Wednesday 28 February 2018

 

I tried to connect the RENTLOSS via a Bridge Table to RENTMAX with only 'PeriodEnd' in it. This way I am able to get both amounts in a Bar Diagram which reacts on the date correctly. Though I am unable to use filters based on the OBJECT table.

 

I know not all data will be filtered correctly, because an AccountNum without a ContractID won't be able to be filtered by dimensions from the OBJECT table, but this is not a problem, since the 'blanks' will then give me info where to increase the quality of the data,

 

I only care about the SUM and Date of the RENTLOSS.AmountRentLoss and RENTMAX.AmountRentMax, I don't care about the details behind the data (such as the ContractID's or AccountNums, etc.).

 

Maybe you guys have any suggestion I haven't thought of.

 

Kind regards,

Igor

1 REPLY 1
Stachu
Community Champion
Community Champion

I'd use values from CONTRACT in slicer, and use the measures as follows:
as RENTMAX has join

MeasureRentMax = SUM(RENTMAX[AmountRentMax])

and as RENTLOSS doesn't have join

MeasureRentLoss =
CALCULATE (
    SUM ( RENTLOSS[AmountRentLoss] ),
    INTERSECT ( ALL ( RENTLOSS[AccountNum] ), VALUES ( CONTRACT[AccountNum] ) )
)

as for the dates I would create a new Calendar table and link it to both tables



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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