Forum Discussion

Jugu22's avatar
Jugu22
Regular Visitor
8 years ago
Solved

Create relation in 2 tables

Hello,   I want to create a relation between 2 tables to create a ratio : on the numerator an amount from a table and on the denominator an amount on the other table.   The problem is I have a lo...
  • v-haibl-msft's avatar
    v-haibl-msft
    8 years ago

    Jugu22

     

    You can create a measure with following DAX formula without creating relationship between these two tables.

     

    Measure = 
    VAR TempDate =
        CALCULATE ( MAX ( Table1[Date] ) )
    VAR TempExpectedSales =
        CALCULATE (
            SUM ( Table2[Expected Sales] ),
            FILTER ( ALL ( Table2 ), Table2[Date] = TempDate )
        )
    RETURN
        CALCULATE ( SUM ( Table1[Actual Sales] ) ) / TempExpectedSales
    

     

    Best Regards,
    Herbert