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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
fcarro
New Member

Relation active but not working

Hi everyone,

 

I've been stuck on this error for some days now... I want to see the number of hypermarkets and supermarkets that have this or this item:

PBI H S issue.PNG

 

For the supermarkets it works perfectly but for the hypermarkets it sums up everything when I use the "assortment code" field...

Both "Supermarket" and "Hypermarket" tables have exactly the same format and are structured the same way.

 

Despite being active, it's like the relation between the two tables "Assortment" and "Hypermarket" is not working.

All the data used in the graphics are from the unique value tables.

 

Here is the PBI file where I removed all the confidential informations.

 

 

Thank you.

 

PBI H S issue 2.PNGPBI H S issue 3.PNGPBI H S issue 4.PNG

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @fcarro

 

The Hypermarket[Assortment Code] column seems to have an extra space at the end of the code.  Relationships need an exact match to work.  I added a calculated column using LEN('Hypermarket'[Assortment code]) and it was returning a value of 4 (the other tables were returning 3.

 

I created a new calculated column in the Hypermarket table to test as follows

 

image.png

When I changed the relationship to use this new column, it worked.

 

I recommend you fix the problem in the query editor.  Highlight the column in question and use the "Clean" and "Trim" options to tidy up.  Probably best to do this on both tables.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @fcarro

 

The Hypermarket[Assortment Code] column seems to have an extra space at the end of the code.  Relationships need an exact match to work.  I added a calculated column using LEN('Hypermarket'[Assortment code]) and it was returning a value of 4 (the other tables were returning 3.

 

I created a new calculated column in the Hypermarket table to test as follows

 

image.png

When I changed the relationship to use this new column, it worked.

 

I recommend you fix the problem in the query editor.  Highlight the column in question and use the "Clean" and "Trim" options to tidy up.  Probably best to do this on both tables.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thank you but I just found the solution 10 minutes ago !

 

While double checking again my data I've seen this extra space that was hiding...

 

Thanks for the formula, next time I'll start by trimming my values.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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