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

Dimension Relationship Problem

I have a model like below.

ModelModel

 

Dimensions:

  • Project Code
  • Building Code
  • Area
  • Location

Fact:

  • HLC NCR Report

 

Building Code, Area and Location has no relation between them. They only have a common column which is Project Code.

I need a model that, Project Code filter all  other dimensions (Building Code, Location and Area). Because first I need to see the dimensions related to that Project Code.

And after that, Building Code, Location and Area filters the fact table (HLC NCR Report). I also want to see the dimension that has no record on the fact table. Even its value shows zero. Thats why I can’t use both sided relation (Even I have Project Code field on fact).

How can I activate the relationship between Project Code and others. How can I build the model?

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may apply virtual relationship in DAX measure.

https://www.sqlbi.com/articles/physical-and-virtual-relationships-in-dax/

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may apply virtual relationship in DAX measure.

https://www.sqlbi.com/articles/physical-and-virtual-relationships-in-dax/

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
LivioLanzo
Solution Sage
Solution Sage

Hello @Anonymous,

 

as far as I see, you can link the project code dimension directly to the fact table, you do not need to traverse any of the three other dimensions. The relationship between 'Project Code' and and Area, Location, Building is already present in the fact table. 

 

Capture.PNG

 

Also, are you sure that Building, Location and Area do not have a one to many relationship going from Building > Location > Area?  Can a building really belong to multiple locations? Can a location really belong to multiple areas?

 


 


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


Proud to be a Datanaut!  

Anonymous
Not applicable

Hello @LivioLanzo;

 

Many thanks for your reply.

 

If I do what you suggested, I can not filter building, Area and Location related to that project code. For doing this, I have to build both sided relationship between Fact and (Location, area and building) as below. (Please correct me if I am wrong)

 

Screenshot_1.png

 

But I don't want this, because I want to see all Locations even if it has no value on the fact table.

 

And yes, I asked many times unfotunately building, location and area has no link. They named the data like this. But it has no common column except Project Code.

Hello @Anonymous!

 

if you get rid of the bi-directional filter (highly suggested) then the 'Project Code' dimension will filter the fact table but then the fact table does not filter the other three dimensions (giving you the effect that you want). 

 

Also notice that there are columns in the fact table that you do not need anymore and can be removed to make your model lighter, for instance 'Area', 'Location', 'Building Code' are all attributes of the three dimensions so they can go and probably there're a few more like this 

 


 


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


Proud to be a Datanaut!  

Anonymous
Not applicable

Thanks @LivioLanzo;

 

Yes I understand, I will clear the columns. 

 

I don't want both sided becuse they want to see the zero values also. For example, All the Locations, that project A has. If I build a both sided relation to the fact, fact also filter the Location table. So I can not see the Location which havent got a value on the fact. 

 

But they want to know all Locations, for asking why there is no transaction to this Location.

 

In this case, I tried many relationship scenarios, but I couldn't solve.

Hi @Anonymous,

 

try with the bi directional filter removed and also on your matrix you can enable 'Show items with no data'

 

Capture.PNG

 


 


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


Proud to be a Datanaut!  

Anonymous
Not applicable

Thats ok @LivioLanzo. But when I remove bidirectional Project Code can not filter Building, Location, Area Tables. How can we handle this?

@Anonymous

 

use CROSSFILTER: https://docs.microsoft.com/en-us/dax/crossfilter-function

 


 


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


Proud to be a Datanaut!  

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.

Top Solution Authors