# What is the correct context when making a formula with a what if parameter?

I am trying to multiply a what if parameters but I am struggling to define the correct context.

In my case, we an incentive program which provides 3 different rebates. Rebate 2 & 3 are already determined but rebate 1 is the difference between Total incentives - rebate 2 and 3. While total incentives is a dynamic function depending on the net profit.

In my model, Rebate 1 calculation does not apply correctly to all the customer. My context is probably wrong but I am unable to use the correct filters to get the â€śrebate 1 %â€ť applied to all customers.

Any thoughts?

See attached the PBIX data file
Rebate example.pbix (38.0 KB)

Hi @JayLocher,

I donâ€™t understand the problem you are encountering.

When I see all the results in the table, it seems ok.

So I think I didnâ€™t understand your problem wellâ€¦
Can you please try to explain it again ?
And maybe you could give the results you are waiting for.

Best regards,
Joaly

Hi @JBocher ,

Sorry if I wasnâ€™t clear. Considering a net profit of 3380, â€ś% of rebate 1â€ť, should be set at 35%, this is calculated with the â€śRebate 1 %â€ť measure. This % applies to all customer for rebate 1.

In the table you sent, the rebate 1 % is set at 97% for customer 1 because the calculation is considering 1311.50 as rebate 1 total whereas I only need the 35% to be multiplied by the annual revenue.

I would like to filter the 35% result and apply it to every single line item.

Does it clarify the issue?
Thanks

Iâ€™ve changed the formula for Rebate 1 % in order to have 35% for each customer.
Iâ€™ve only changed the context of the calculation by adding a â€śALLâ€ť function for the customers name.

The table is now this one :

Is this the results you want ?

The solution file :
Rebate example.pbix (39.3 KB)

Best regards,
Joaly

@jbocher

Thank you so much for looking at this. This is definitely working on my example file. I felt a bit embarrassed on how easy this was.

Even if it works on the example file, it does not work in my model.

I need to dig into this to understand why it does not work on my side.

Thanks again
Best regards

@JayLocher

I hope you will find the solution for your model.
If itâ€™s not the case and you have any questions, feel free to ask

Best regards,
Joaly

So I was able to identify what is not working but I am not sure why.

My model has an additional layer which I have added to the example file.

I have added a new measure â€śRebate 1 at 100%â€ť. This represents how much rebate would represent if this was paid at 100%.

To define â€śRebate 1 %â€ť, I divide the current rebate 1 Total by â€śRebate 1 at 100%â€ť . Based on the printscreen below the result is 27%

However, this is not the what I get in the table, the column shows weird results.

Interestingly enough, if I remove the â€śallowanceâ€ť row, then the % is correct, but the â€śrebate 1 valueâ€ť is not the expected value.

Any toughts?
Best regards
Rebate example.pbix (38.5 KB)

Hi @JayLocher,

I managed to understand why there is a problem.
You need to change the Rebate 1% like that :

Iâ€™ve changed the ALL( Data[ Customer Name] ) with ALL( Data ).
In that way, you can add on your table all the Data columns you want and the result will not change.

Nonetheless, the best practice is to always create measures to show data numbers on tables and not use the data directly.

So Iâ€™ve created a Total Annual Revenue measure

Then Iâ€™ve changed the measure Rebate 1 value just to use the Total Annual Revenue Iâ€™ve created

With all the changes have made, the formulas seem to work.
Here is the result :

Rebate example (1).pbix (39.4 KB)

Best regards,
Joaly

1 Like

Thank you so much. It is working very well and thank you for the tips regarding the best practice, i will try to apply this on other measures that I do have on my side.

It is somewhat amazing that the solution was so easy - meaning applying ALL (DATA) -instead of the first solution - but I struggled so much with this.

Thanks again for your assistance - this is best valuable assistance.
Best regards

1 Like