DAX Expression Help

Spyderturbo007

New Member
Joined
Mar 11, 2022
Messages
21
Office Version
  1. 365
Platform
  1. Windows
I've been trying to learn DAX and am stuck at my first calculation. I have two tables that rely on this calculation.

fOrders -> Table that includes all the orders for 2024
dDiscounts -> Table that includes discount codes that can be used for the orders along with a column named Commission Payable. That column determines if the sales person gets paid commission on the discount amount.

In some cases, we give customers a coupon code for 100% off. They then get billed at the end of the month for it's usage. The company still pays commission on that amount, but because of limitations with our software, that code gets lumped into other discount codes that give the customer 10% off. On those codes, we don't pay commission.

My software gives me Order Total, but that total is after the discount is applied. So if I just evaluated things as they are, my sales people wouldn't get paid on some orders that were completely or partially paid later.

I think I want the expression to do a SUMX and when it sees a dDiscounts[Commission Payable], if adds the absolute value of fOrders[Discount Total] to fOrders[Order Total]. If dDiscounts[Commission Payable] = No, then it just returns the fOrders[Order Total] for that row.

That should give me total revenue, some of which is collected at the time of checkout and the balance is collected later via ACH or check.

Hopefully that makes sense. I have this, but I'm not sure if I'm way off base, or if I'm even close. It's giving me an error.

Measure 1:=SUMX(fOrders,IF(RELATED(dDiscounts[Commission Payable])=Yes,fOrders[Order Total]+ABS(fOrders[Discount Total]),fOrders[Order Total]))
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You need quotes round "Yes"
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top