March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello everyone,
I have an item table:
item_id price
01 5
02 10
03 7
And I have an event table:
event_id item_id
grty 02
bfgz 03
fdbx 03
azrq 02
One item can be affected by multiple events.
I would like to have a measure that will sum the total price of all items that are present in the event table.
In this example, that would be item 02 and 03. Therefore the total price would be 17.
Can anyone kindly help me with this DAX problem?
Thanks in advance,
Lucas
Solved! Go to Solution.
@lucasrm , Try one of the two. if first one joined
calculate(sum(Table[price]), filter(event, not(isblank(event[item_id]))))
or
calculate(sum(Table[price]), filter(Table, Table[item_id] in allselected(event[item_id])))
@lucasrm in this case first you need to create a relationship between two tables like below
then below is output you are looking for
let me know if it helps you. attached pbix file for reference.
Proud to be a Super User!
Hello @negi007 !
Thanks for the help but unfortunately that was not what I was looking for. I had already the two tables linked. I actually needed a measure so I could calculate totals and etc.
I took your pbix file and used the DAX from @amitchandak and it worked!
Here's the result I was looking for:
Thanks anyway for the help!
@lucasrm , Try one of the two. if first one joined
calculate(sum(Table[price]), filter(event, not(isblank(event[item_id]))))
or
calculate(sum(Table[price]), filter(Table, Table[item_id] in allselected(event[item_id])))
Thanks @amitchandak , it worked great!
I tried something similar before but I was afraid that this type of DAX would sum repeatedly the price for each occurence of item in the event table. I was wrong, it worked perfectly!
Thanks for your help!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |