Forum Discussion

JeroenHD's avatar
JeroenHD
Icon for Helper I rankHelper I
4 years ago
Solved

How to Sum Values based on (Value -1) from other column

Hello Community Members,  I am struggeling with the following. I have a fairly simple table. No date dimensions unfortunately.  The rows contain a period number. Which can be from 1 - 12. I need ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi JeroenHD,

    Can you please share some more detail about these table structures and relationship mapping?

    How to Get Your Question Answered Quickly  

    You can extract the second table relationship key values based on the current selection, and use these extract values as conditions to filter on the first table.

    formula =
    VAR selected =
        CALCULATETABLE ( VALUES ( Table2[key] ), ALLSELECTED ( Table2 ) )
    RETURN
        CALCULATE (
            SUM ( Table1[Amount] ),
            FILTER ( ALLSELECTED ( Table1 ), [key] IN selected )
        )

    Regareds,

    Xiaoxin Sheng