Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hello guys, it's my first post here and I'm very glad to be part of this forum.
Recently I'm trying to deal with a logical sum in DAX and to be honest I not dealing with it really well...
My problem is:
I have 3 tables:
I want to sum the MB52[Quantity] based on Current and Old Keys, reaching this result:
Identifying [Current Key] and suming the quantity of the [Old. Key] with owns [Current Key] quantity.
I tried this code but with no sucess 😞
[Sum. Quantity] =
IF
(
'KEYS'[Old. Key] <> "";
CALCULATE(SUM(MB52[Quantity]) ; MAX(MB52[Key]) = MAX('KEYS'[Old. Key])) + CALCULATE(SUM(MB52[Quantity]) ; MAX(MB52[Key]) = MAX('KEYS'[Current Key]));
SUM(MB52[Quantity])
)
I apreciate a lot your help and thanks anyway 🙂
Solved! Go to Solution.
in MB52 table
add colnum
current key
var _newKey=lookupvalue(keys[current key],keys[old key],MB52[KEY])
return
if(_newKey = blank(), MB52[KEY],_newKey)
then make relationhip MB52[current key] and product[current key]
It's not the expected way I was thinking to reach it, but it worked like a charm hahahaha
Thanks so much!
in MB52 table
add colnum
current key
var _newKey=lookupvalue(keys[current key],keys[old key],MB52[KEY])
return
if(_newKey = blank(), MB52[KEY],_newKey)
then make relationhip MB52[current key] and product[current key]
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |