Forum Discussion
Calculating UK National Insurance rates
- 4 years ago
Hi Molin
I had the chance today to look into your file and write some code. I will send you the file in a private message. Following is the description of the solution. However, I still have doubts on whether to consider the calculations on weekly basis or accomulated monthly bases. At the end I decided to go with the weekly based calculation.
The first step was to import the tax lookup tableThen created the relationship.
Created the measures
Actual Cost = SUM ( LaborCost[ActualCost] )NI Measure = SUMX ( CROSSJOIN ( VALUES ( DateTable[YYYYWW] ), VALUES ( LaborCost[PayrollId] ) ), VAR Cost = [Actual Cost] VAR R1 = CALCULATE ( VALUES ( Tax[R1] ), CROSSFILTER ( LaborCost[NICategory], Tax[Category], BOTH ) ) VAR R2 = CALCULATE ( VALUES ( Tax[R2] ), CROSSFILTER ( LaborCost[NICategory], Tax[Category], BOTH ) ) VAR R3 = CALCULATE ( VALUES ( Tax[R3] ), CROSSFILTER ( LaborCost[NICategory], Tax[Category], BOTH ) ) RETURN SWITCH( TRUE(), Cost < 120, 0, Cost >= 120 && Cost <= 184, ( Cost - 120 ) * R1, Cost > 184 && Cost <= 967, 64 * R1 + ( Cost - 184 ) * R2, 64 * R1 + 783 * R2 + ( Cost - 967 ) * R3 ) )This is how the report looks like
You can upload to WeTransfer for example and share the link.
Hi temerj1
Here you go. https://we.tl/t-XVGmDP5uD9
Again many thanks!
- v-easonf-msft4 years ago
Community Support
Hi, Molin
I've checked your pbix file and there seems to be no better way.
I'm afraid you have to calculate them according to different situations.
Best Regards,
Community Support Team _ Eason