Forum Discussion
Using dax to get latest value from another table
- Anonymous4 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
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