Forum Discussion
Dax for Bonus Threshold
lbendlin Thanks for the quick reply, I assumed some data.
The table data is shown below:
Please follow these steps:
1. Use the following DAX expression to create a measure named ‘Product A Sales Bonus’
Product A Sales Bonus =
VAR _a =
DIVIDE (
SUMX (
'Tabelle1',
'Tabelle1'[Sales of product A this year] - 'Tabelle1'[Sales of product A last year]
),
SUMX ( 'Tabelle1', 'Tabelle1'[Sales of product A last year] ),
0
) * 100
VAR _c =
SUMX (
'Tabelle1',
[Sales of product A this year] - [Sales of product A last year]
)
VAR _b =
IF (
SUM ( Tabelle1[Sales of product A this year] ) >= 1000000,
SWITCH (
TRUE (),
_a < 10, SUM ( Tabelle1[Sales of product A this year] ) * 0.01,
_a = 10,
SUM ( Tabelle1[Sales of product A this year] ) * 0.01 + _c * 0.02,
_a > 10
&& _a <= 15,
SUM ( Tabelle1[Sales of product A this year] ) * 0.01 + _c * 0.03
),
SWITCH (
TRUE (),
_a < 10, 0,
_a = 10, _c * 0.02,
_a > 10
&& _a <= 15, _c * 0.03
)
)
RETURN
_b
2. Use the following DAX expression to create a measure named ‘Total Revenue Bonus’
Total Revenue Bonus =
IF (
EXACT ( MAXX ( 'Tabelle1', [Type] ), "customer1" ),
SWITCH (
TRUE (),
SUM ( Tabelle1[Total revenue] ) < 1000000, 0,
SUM ( Tabelle1[Total revenue] ) >= 1000000
&& SUM ( Tabelle1[Total revenue] ) < 2000000, SUM ( Tabelle1[Total revenue] ) * 0.05,
SUM ( Tabelle1[Total revenue] ) > 2000000, SUM ( Tabelle1[Total revenue] ) * 0.07
),
SWITCH (
TRUE (),
SUM ( Tabelle1[Total revenue] ) < 2000000, 0,
SUM ( Tabelle1[Total revenue] ) >= 2000000
&& SUM ( Tabelle1[Total revenue] ) < 5000000, SUM ( Tabelle1[Total revenue] ) * 0.07,
SUM ( Tabelle1[Total revenue] ) > 5000000, SUM ( Tabelle1[Total revenue] ) * 0.08
)
)
3. Use the following DAX expression to create a measure named ‘Total Bonus’
Total Bonus = [Product A Sales Bonus] + [Total Revenue Bonus]
4. Final output
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Tarek782 years ago
Helper I
Thanks so much for your help, I will try to understand and follow your formula.
my preferred option would be to create a data model. Do you have knowledge on this? Maybe I could send the details in excel and we could find together the best data model to create ?