Forum Discussion
Molin
Helper I
4 years agoCalculating UK National Insurance rates
Dear all, I am working on a costing overview but are challenged by adding UK National Insurance (NI) on top of the base salary for our employees. Employees are categories into different National ...
- 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
Molin
Helper I
4 years agoHi temerj1
Here you go. https://we.tl/t-XVGmDP5uD9
Again many thanks!