Forum Discussion

ReadTheIron's avatar
ReadTheIron
Helper III
3 years ago
Solved

Replace codes with full text based on table

I have one table of records that uses abbreviations to describe problem codes, like this:

 

EventTable

DateProblem Code
1/2/2022ABC
1/3/2022CDE
1/3/2022ABC
1/4/2022XYZ

 

I have another table with a key to the problem codes:

ProblemKey

Problem CodeProblem Description
ABCFlood
CDEFire
EFGHurricane
XYZSharknado

 

I'd like to create a calculated column in EventTable that shows the full text of Problem Description

DateProblem CodeProblemFull
1/2/2022ABCFlood
1/3/2022CDEFire
1/3/2022ABCFlood
1/4/2022XYZSharknado

 

I know I can relate the tables on ProblemCode, but I want to use the full text of Problem Description in various graphics using data from EventTable. I'm fairly sure this is a simple operation, but I'm drawing a blank. Any help appreciated!

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  ReadTheIron ,

     

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    var _select=SELECTCOLUMNS('EventTable',"1",[Problem Code])
    return
    MAXX(
        FILTER(ALL('ProblemKey'),
        'ProblemKey'[Problem Code] in _select),[Problem Description])

    2. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

5 Replies