Forum Discussion

kruzack's avatar
kruzack
Frequent Visitor
3 years ago
Solved

Adding new field to Calculated Table

Hi All,   I have created 2 calculated tables from my base data, and then I am joining the 2 tables using naturalleftouter join In both tables I have Date, CustomerID and Status. Below is how the...
  • tamerj1's avatar
    tamerj1
    3 years ago

    kruzack 
    For a measure please try

    Practice =
    VAR fromtable =
        SELECTCOLUMNS (
            CollectionMonthlyDailyFrom,
            "loanno", CollectionMonthlyDailyFrom[LOANNO] & "",
            "dpd_group", CollectionMonthlyDailyFrom[DPD Group],
            "report_date", CollectionMonthlyDailyFrom[REPORT_DATE],
            "DPD Group Num", CollectionMonthlyDailyFrom[DPD Group Num]
        )
    VAR totable =
        SELECTCOLUMNS (
            CollectionMonthlyDailyTo,
            "loanno", CollectionMonthlyDailyTo[LOANNO] & "",
            "dpd_group_1", CollectionMonthlyDailyTo[DPD Group],
            "report_date_1", CollectionMonthlyDailyTo[REPORT_DATE],
            "@DPD Group_1 Num", CollectionMonthlyDailyTo[DPD Group Num]
        )
    VAR Result =
        ADDCOLUMNS (
            NATURALLEFTOUTERJOIN ( fromtable, totable ),
            "DPD Group_1 Num", COALESCE ( [@DPD Group_1 Num], 1 )
        )
    RETURN
        COUNTROWS ( FILTER ( Result, [DPD Group_1 Num] > [DPD Group Num] ) )