cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sampak Regular Visitor
Regular Visitor

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

Accepted Solutions
Super User
Super User

Re: One table values to another, new column, replacing codes

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

 

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
Proud to be a Datanaut!

View solution in original post

6 REPLIES 6
Super User
Super User

Re: One table values to another, new column, replacing codes

Hey,

 

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

 

Regards

Tom

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
Proud to be a Datanaut!
sampak Regular Visitor
Regular Visitor

Re: One table values to another, new column, replacing codes

hey,

 

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

Super User
Super User

Re: One table values to another, new column, replacing codes

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

 

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
Proud to be a Datanaut!
sampak Regular Visitor
Regular Visitor

Re: One table values to another, new column, replacing codes

 

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

Super User
Super User

Re: One table values to another, new column, replacing codes

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

 

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
Proud to be a Datanaut!

View solution in original post

sampak Regular Visitor
Regular Visitor

Re: One table values to another, new column, replacing codes

Thanks, very much, that worked for me!

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 143 members 2,079 guests
Please welcome our newest community members: