cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

One table values to another, new column, replacing codes

Hi,

 

I have two tables:

1. GAP(gap_value, gap_label, gap_value_ref) - Gap value is just a code, and label is its representation. Gap_value_ref is in an indicator which table, and which column it refers to.

sample data:

gap_value,    gap_label,                    gap_value_ref

1,               Customer,                      incident_customertypecode-1

2,               Supplier,                        incident_customertypecode-2

1,               Customer Complaint,    incident-casetypecode-1

2,               Customer Problem,       incident-casetypecode-2

 

2.Incident (id, casetypecode, customertypecode, gap_value_ref_caseType, gap_value_ref_customerTypecode)

Sample data:

id  casetypecode, customer type code   gap_value_caseType           gap_value_customerTypeCode

1           1                             1                 incident-casetypecode-1    incident_customertypecode-1

2           1                             2                 incident-casetypecode-1    incident_customertypecode-2

3           2                             1                 incident-casetypecode-2    incident_customertypecode-1

4           2                             2                 incident-casetypecode-2    incident_customertypecode-2

 

 

How can I replace / create additional column that would bring gap_label value from table GAP into INCIDENT? Any ideas? 

 

Thanks!

 

 

 

 

 

1 ACCEPTED SOLUTION

Hey,

 

I would create two calculated columns in the INCIDENT table using DAX:

CaseTypeLabel = 
    LOOKUPVALUE(GAP[gap_label],GAP[gap_value_ref],'INCIDENT'[gap_value_caseType])

and

CustomerTypeLabel = 
    LOOKUPVALUE(GAP[gap_label],GAP[gap_value_ref],'INCIDENT'[gap_value_customerTypeCode]) 

then you get an INCIDENT table that looks like this

2017-09-19_23-58-50.png

 

Hope this is what you are looking for

 

Regards

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

6 REPLIES 6
Super User II
Super User II

Hey,

 

can you please provide how the additional column in your table INCIDENT should be filled.

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

hey,

 

the code value in table INCIDENT should be replaced with gap_label from GAP

Hey,

 

sorry for not being precise, please provide the complete table INCIDENT after the replacement happened. This will help us to come up with a solution.

 

Regards

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

 

The final result to be something like this:

id               casetypecode,              customer type code        gap_value_caseType           gap_value_customerTypeCode

1          Customer Complaint                   Customer               incident-casetypecode-1    incident_customertypecode-1

2          Customer Complaint                    Supplier                 incident-casetypecode-1    incident_customertypecode-2

3           Customer Problem                     Customer                incident-casetypecode-2    incident_customertypecode-1

4           Customer Problem                     Supplier                   incident-casetypecode-2    incident_customertypecode-2

Hey,

 

I would create two calculated columns in the INCIDENT table using DAX:

CaseTypeLabel = 
    LOOKUPVALUE(GAP[gap_label],GAP[gap_value_ref],'INCIDENT'[gap_value_caseType])

and

CustomerTypeLabel = 
    LOOKUPVALUE(GAP[gap_label],GAP[gap_value_ref],'INCIDENT'[gap_value_customerTypeCode]) 

then you get an INCIDENT table that looks like this

2017-09-19_23-58-50.png

 

Hope this is what you are looking for

 

Regards

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

Thanks, very much, that worked for me!

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors