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
dhersz
Frequent Visitor

Create a relationship between column created via LOOKUPVALUE and the source column

Hello,

 

I'm trying to create a relationship between two columns, but one of them was created via LOOKUPVALUE and the column from which it gets the value is exactly the one I'm trying to relate to. Is that possible?

 

What I'm trying to achieve is the following:
I have a database of clients' open projects and a database of yearly goals, with clients in it. Ideally I'd like to create a relationship between this columns, but that would result in an error, since it would be a multiple values to multiple values relation.

My solution was to create an intermediate table between these, with unique names of clients.

 

However, some of the clients with open projects were not predicted in the yearly goals (and I need the visual to be based on the goals' sheet), so I created a field called "other" as well. So in my open projects sheet I created a calculated column with LOOKUPVALUE (so it returns either the name of the client or "other").

 

Now I'd like to create a relationship between this new column and the intermediate table (so I can use the intermediate table's "client" field to filter my visuals) but it results in a "circular dependency" (not sure if that's the term, my power bi language is portuguese).

 

Is there a better way to make what I'm trying to achieve?

 

Thank you in advance

2 REPLIES 2
Greg_Deckler
Super User
Super User

Yeah, that would definitely be a circular dependency and DAX is seriously not OK with that. If you could provide some sample/example data, this would be far easier to understand and see if there is a better way.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

No worries, I'll provide some pictures and show what I've been doing already.

 

So here is how I'm doing right now (with another table, "Vertical").

Both the "CRM" and "Meta" tables also have "Vertical" fields, and I created this relationship below so I can apply one filter to alter visuals based on both tables.

image.png

 

I'm trying to do the same with the "Clients" field on both table. However, these columns differ a bit from each other.

 

Let's say that in the CRM table I have something like this:

 

Stage | Value | Client
Stg 1 | 1000  | Client A

Stg 2 | 2000  | Client B

Stg 1 | 1000 | Client C

 

And in the "meta" table I have yearly goals for both Client A and Client B, but no C, so I'd like to create another column which would return me something like:

 

GoalsClient

Client A

Client B

Other

 

Now, I did this with LOOKUPVALUES, just looking for the client in the column and, in case of blank, fill it with "Other".

Then I would like it to a Unique Values table, just like I did with "Vertical" and I'd create a slicer to filter my visuals.

 

The code right now to the LOOKUPVALUES looks like this:

 

ClienteMeta = IF(
    ISBLANK(LOOKUPVALUE('Info cliente'[teste], 'Info cliente'[Cliente], 'CRM - Acompanhamento geral'[Cliente])) = FALSE(),
    LOOKUPVALUE('Info cliente'[teste], 'Info cliente'[Cliente], 'CRM - Acompanhamento geral'[Cliente]),
    "Outros/Pulverizado"
)

(The LOOKUPVALUES is looking up to the Unique Values table, not the "Meta[Client]" column (it returns circular dependency anyway))

 

Is it clearer now?

Thank you very much

 

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.