Forum Discussion

Swilson2112's avatar
Swilson2112
Frequent Visitor
4 years ago
Solved

Return a value from a table based on comparing two different fields in that same table..

I have this table:    I want to compare the Invoice Date Column vs the Change Date Time Column and then return the Last Daily Change for the Change Date Time that has the closest before value.   ...
  • v-cazheng-msft's avatar
    4 years ago

    Hi Swilson2112 ,

     

    You may try this Measure.

    Last Daily Change Value =

    VAR max_date =

        MAXX (

            FILTER ( 'Table', 'Table'[INVOICE DATE] > 'Table'[Changed Date Time] ),

            'Table'[Changed Date Time]

        )

    RETURN

        CALCULATE (

            MAX ( 'Table'[Last Daily Change] ),

            FILTER ( 'Table', 'Table'[Changed Date Time] = max_date ),

            VALUES ( 'Table'[INVOICE] )

        )

     

    Then, the result will look like this.

     

    Also, attached the pbix file as reference.

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

     

    Best Regards,

    Community Support Team _ Caiyun