powerbimeasure

PBI : Measure based on 2 columns from 2 different tables


I have a 2 tables : 1 Fact table 1 Dimension table

for certain entries in my fact table, I can have a comment and in this case I would like to display it instead of displaying the dimension table value. Of course in an unique column in the visual table

I guess I need to create a Measure but I can't seem to use text values. Is this the right method and how do I go about it?

enter image description here

Thanks


Solution

  • If you want to calculate this for each row of your fact table, it might be easier to add a calculated column to the fact table rather than use a measure.

    Here's a basic expression you could use in a calculated column in the fact table (it assumes that there's a many-to-one relationship between the fact table and dimension table):

    What I want Calculated Column = IF(
        ISBLANK('FACT table'[Comment]),
        RELATED('Dim table'[Description]),
        'FACT table'[Comment]
    )
    

    This gives me the following results:

    Results of DAX calculated column in Power BI