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
Item | Mother Item | Sales |
A | 1 | |
B | A | 2 |
B | A | 1 |
C | D | 3 |
D | 4 | |
E | 2 | |
E | 4 | |
Total | 17 |
I have former sales table.
Some of Item has a mother item(B's mother item is "A", "C"'s mother items is"D", and "E" doesn't have a mother item.) I would like to sum up the sales of each item like below.
A and B have the value samely summing "A" sales Sum + "B" sales Sum (1+2+1=4)
C and B have the value samely summing "C" sales Sum + "D" sales Sum(3+3=6)
E has sales 2pcs and 4pcs all together 6pcs. is it possible?
Total sales should be 17 as below.
Item | Sales Sum |
A | 4 |
B | 4 |
C | 7 |
D | 7 |
E | 6 |
Total | 17 |
Solved! Go to Solution.
You can refer to the following measure
Sum = var a=SUMMARIZE(FILTER(ALL('Table'),[Item]=SELECTEDVALUE('Table'[Item])),[Item])
var b=SUMMARIZE(FILTER(ALL('Table'),[Item]=SELECTEDVALUE('Table'[Item])),[Blank Item])
return SUMX(FILTER(ALL('Table'),OR([Item] in SUMMARIZE(FILTER(ALL('Table'),OR('Table'[Item]=SELECTEDVALUE('Table'[Item]),[Blank Item]=SELECTEDVALUE('Table'[Item]))),[Item]),[Item] in UNION(a,b))),[Sales])
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Just create a new measure
Best Regards!
Yolo Zhu
According to your sample data the sum for A should be 3 ?
I've changed "blank item" terms to relative item.
I want to sum each item's Sales both original item and relative item.
so relative item and original item could have same sum value as example.
The second B item does not have a related A item.
sorry my bad.
I've changed it.
Hi
!?!?!?!?
You can refer to the following measure
Sum = var a=SUMMARIZE(FILTER(ALL('Table'),[Item]=SELECTEDVALUE('Table'[Item])),[Item])
var b=SUMMARIZE(FILTER(ALL('Table'),[Item]=SELECTEDVALUE('Table'[Item])),[Blank Item])
return SUMX(FILTER(ALL('Table'),OR([Item] in SUMMARIZE(FILTER(ALL('Table'),OR('Table'[Item]=SELECTEDVALUE('Table'[Item]),[Blank Item]=SELECTEDVALUE('Table'[Item]))),[Item]),[Item] in UNION(a,b))),[Sales])
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your reply.
it works very well. however, could I have total sum ?17 at the bottom of table?
Just create a new measure
Best Regards!
Yolo Zhu
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 |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
146 | |
97 | |
79 | |
69 |