Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Needing to create a calculated column that takes into account several other columns as well. A sample of my data is below.
Basically I need to take the revenue for the rows with an item version of "S" and evenly distribute that total revenue across non "s" items of the same order number and factor in quantity as well. For order 10001, there is $10 of "s" revnue and it would need to be broken up in $2.00 increments for the 5 total items that were sold.
For Order 10002, there is $12.00 of "s" revenue that gets distributed amongs the 4 other total items.
The "s" quantity is always 1.
Thanks
Solved! Go to Solution.
HI, @awitt
You could use this formula as below:
Column =
IF (
Sheet2[Item Version] <> "S",
CALCULATE (
SUM ( Sheet2[Per Item Revenue] ),
FILTER (
Sheet2,
Sheet2[Order #] = EARLIER ( Sheet2[Order #] )
&& Sheet2[Item Version] = "S"
)
)
/ CALCULATE (
SUM ( Sheet2[Quantity] ),
FILTER (
Sheet2,
Sheet2[Order #] = EARLIER ( Sheet2[Order #] )
&& Sheet2[Item Version] <> "S"
)
)
)
Result:
Best Regards,
Lin
Hi @awitt
you can use the all function inside a calculate function to do just this.
The process would be as follows;
Calculate(average, filter(all(TABLE),item version=itemversion))
EDIT: If it is possible to share a copy of your pbix file i would be happy to try and assist in creating such calculation.
Hope this helps
Thanks,
George
That just resulted in averaging the revnue without considering the order # or the quantity at all. Again the goal is to average out only the "S" revenue per order # amoungst all of the non "S" items.
HI, @awitt
You could use this formula as below:
Column =
IF (
Sheet2[Item Version] <> "S",
CALCULATE (
SUM ( Sheet2[Per Item Revenue] ),
FILTER (
Sheet2,
Sheet2[Order #] = EARLIER ( Sheet2[Order #] )
&& Sheet2[Item Version] = "S"
)
)
/ CALCULATE (
SUM ( Sheet2[Quantity] ),
FILTER (
Sheet2,
Sheet2[Order #] = EARLIER ( Sheet2[Order #] )
&& Sheet2[Item Version] <> "S"
)
)
)
Result:
Best Regards,
Lin
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 54 | |
| 37 | |
| 34 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 72 | |
| 72 | |
| 38 | |
| 35 | |
| 26 |