Search code examples
mergepowerbi-desktoplookup-tables

replicate subquery in PowerBI


I have two tables: enter image description here

The merge is on the field name value of the JLE_LineTypeCategory matching the Type and Line Type columns on JobLedgerEntry. In SQL, I would do something like this:

 SELECT optiontext 
    FROM metadataTable md
    WHERE TableName='JobLedgerEntry' 
        AND FieldName='LineType' 
        AND md.OptionInteger=JobLedgerEntry.[Type]
) as 'Type'

but I'm not sure how to do that in BI. Basically, I'm looking at the value of a field in the JLE_LineTypeCategory table to match with the column name in the JobLedgerEntry table.


Solution

  • Since I only needed one set of field descriptors, I filtered the LineTypeCategory table to just the 3 possible values for the JobLedgerEntry.LineType field. I then merged the two tables on the optionInteger-LineType fields.