Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Summing / retrieving values based on Distinct Key

I have two related tables   Table A contains a unique key and some qty attached to it, e.g.    _Key                 |    QTY UniqueKey1    |    5 UniqueKey2   |    10 UniqueKey3    |    1 Uni...
  • parry2k's avatar
    8 years ago

    Here is what you need to, set relationship between both tables on key field.

     

    and add following column in Tableb

     

    Qty = RELATED(Tablea[Qty])

    Unique =  FORMAT(Tableb[Date], "YYYYMMDD") & Tableb[Key]

     

    Add following measures in table b

     

    Max Qty = MAX(Tableb[Qty])

    Qty SUM = SUMX(VALUES(Tableb[Unique]),[Max Qty]) 



    Add table visual, drop date from tableb and Qty SUM measure