Forum Discussion
Tiered Calculation
Hello,
I am trying to come up with a derived column that can calculate a value based on tiers. It's similar to calculating income tax. In my situation, if the contract is worth between $0 and $750,000, then I want 100%. If the contract is greater than $750,000 and less than $2 million, the I want to take that value minus the $750k from the first tier and then multiply the difference by 20%. If the contract is greater than $2 million then the percentage is 0% and the amount is $1 ($750,000 from the first tier + $250,0000 from the second tier). The table that stores these values has a minimum and maximum column based on above. It also has a carryover column and an applied percent column. It is not joined to any other table. The DAX I thought worked, but isn't, goes something like this:
var Current = CurrentAmount
var CarryOver = SUMX(FILTER('TABLE1', 'TABLE1'[Key] = 'CONTRACT[TBL1Key] && CurrentAmount >= 'TABLE1'[AmountMin] && CurrentAmount < 'TABLE1'[AmountMax]), 'TABLE1'[CarryOver])
var AppliedPct = SUMX(FILTER('TABLE1', 'TABLE1'[Key] = 'CONTRACT[TBL1Key] && CurrentAmount >= 'TABLE1'[AmountMin] && CurrentAmount < 'TABLE1'[AmountMax]), 'TABLE1'[AppliedPct])
return CarryOver + ((CurrentAmount - CarryOver)*AppliedPct)
Now the applied percent isn't returning the correct value. Where I would expect 0.20, I'm getting 4 and I have no idea why. Any help would be appreciated! Maybe I'm taking the wrong approach??
1 Reply
- v-yulgu-msftMicrosoft Employee
Hi tlenzmeier,
Please share sample data in all necessary tables and illustrate your requirement with examples. If possible, post an image to show your desired result.
Regards,
Yuliana Gu