Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Values or relatedtable?

Hello,   I have two tables:   Table 1   Obj ID Contract type 1 Accrued 1 Accrued 1 Prepaid 2 Accrued 2 Accrued   Table 2:   Obj ID 1 2   I will crea...
  • bpsearle's avatar
    bpsearle
    6 years ago

    Hi Anonymous 

     

    I’ve been looking at how you would add a calculated column to Table 2 that will do the calculation you want. However, I’m not sure how to do this. SUMX iterates across rows but we don’t actually want that. What we want to do is group by the [Obj ID] and within the group filter on the [contract type] and then with those results apply some computation. This then needs to link back to the row context in table 2.

     

    The only way I can think of doing this is to use the calculated table that I provided the DAX for above. Then add a new calculated column to Table 2 and reference the [amount] column from the calculated table. DAX is “calc col in tbl2” = RELATED(‘calc table’[Amount])

     

    Note that you need to create a relationship between Table2 and the calculated table on the [obj id] column.

     

    Thanks, Brian