Forum Discussion

smiler2021's avatar
smiler2021
Regular Visitor
4 years ago
Solved

Calculated column

Hi all,   Would be great if somebody could help with the following issue:   I have two fact sheets in my power BI (one for budget one for actual)  and i have made a calculated table to link those...
  • v-chenwuz-msft's avatar
    4 years ago

    Hi smiler2021 ,

     

    My example data:

    [AcutalTable]

    [BudgetTable]

    try this dax to creata a new column:

    Column =
    VAR _a =
        CALCULATE(
            MAX( 'AcutalTable'[description] ),
            FILTER(
                AcutalTable,
                [ProjectID] = EARLIER( 'Dim Project Numbers'[ProjectID] )
            )
        )
    VAR _b =
        CALCULATE(
            MAX( 'BudgetTable'[description] ),
            FILTER(
                BudgetTable,
                [ProjectID] = EARLIER( 'Dim Project Numbers'[ProjectID] )
            )
        )
    RETURN
        IF( ISBLANK( _a ), _b, _a )
    

     and result:

    I put my pbix file in the attachment you can refer.

     

    Best Regards

    Community Support Team _ chenwu zhu

     

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