Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Using dax to get latest value from another table

I'd like to update table A with values from Table B. Requirement - to update the latest [Value] based on [Created] where [value] contains 'Quote'. Catch is, if on the same date quote is sent and ap...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    You can create a calculated column as below in table A, please find the details in the attachment.

    Quote_Sub =
    VAR _acnum = 'A'[CASE NUMBER]
    VAR _maxdate =
    CALCULATE ( MAX ( 'B'[Created] ), FILTER ( 'B', 'B'[CASE NUMBER] = _acnum ) )
    VAR _count =
    CALCULATE (
    DISTINCTCOUNT ( 'B'[VALUE] ),
    FILTER (
    'B',
    'B'[CASE NUMBER] = _acnum
    && 'B'[VALUE]
    IN { "Quote Approved", "Quote Sent" }
    && 'B'[Created] = _maxdate
    )
    )
    RETURN
    IF ( _count = 2, "Quote Approved", 'A'[Value] )

    If the above one is not your expected one, please provide some sample data (exclude sensitive data) in the table A and B with Text format and your expected resultwith backend logic and special examples. It is better if you can share a simplified pbix file with me. You can refer the following thread to upload your file in the community. Thank you.

    How to upload PBI in Community

    Best Regards