Forum Discussion
Lookup A Value from Another Table All In One DAX With Many VAR
- Anonymous2 years ago
Hi tecumseh ,
There is no need to split into multiple calculation tables, just in the same calculation table. Using Lookup is table based, your VAR uses multiple ADDCOLUMNS but doesn't retrun it at the end, implying that it wasn't actually created, just an intermediate process. So you just split it into two DAX expressions.
Table for two var = var _t1 = ADDCOLUMNS('Table',"For bigger Sum",SUMX(FILTER(ALL('Table'),EARLIER([ID])<[ID]),[Value])) var _t2 = ADDCOLUMNS(_t1,"For smaller Sum",SUMX(FILTER(ALL('Table'),EARLIER([ID])>[ID]),[Value])) RETURN _t2 ID For 3 = LOOKUPVALUE('Table for two var'[For bigger Sum],[ID],3) ID For 4 = LOOKUPVALUE('Table for two var'[For bigger Sum],[ID],4)An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi tecumseh ,
There is no need to split into multiple calculation tables, just in the same calculation table. Using Lookup is table based, your VAR uses multiple ADDCOLUMNS but doesn't retrun it at the end, implying that it wasn't actually created, just an intermediate process. So you just split it into two DAX expressions.
Table for two var = var _t1 = ADDCOLUMNS('Table',"For bigger Sum",SUMX(FILTER(ALL('Table'),EARLIER([ID])<[ID]),[Value]))
var _t2 = ADDCOLUMNS(_t1,"For smaller Sum",SUMX(FILTER(ALL('Table'),EARLIER([ID])>[ID]),[Value]))
RETURN _t2
ID For 3 = LOOKUPVALUE('Table for two var'[For bigger Sum],[ID],3)
ID For 4 = LOOKUPVALUE('Table for two var'[For bigger Sum],[ID],4)
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.