<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Calculating UK National Insurance rates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2435293#M64969</link>
    <description>&lt;P&gt;Dear all,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;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 Insurance Category Letters following the below rate structures on a weekly basis.&amp;nbsp;&lt;img /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;My data is structured in daily shifts per employee with base salary [ActualCost] and NI Category in seperate coloums as seen below.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Initial idea is to do a SWIFT/IF statement related to a seperate NI Cateogry table, however I cant get my head around it as the daily costs needs to be summed into Weekly costs in order to calculate the correct NI payable.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you so much in advance.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Apr 2022 10:21:40 GMT</pubDate>
    <dc:creator>Molin</dc:creator>
    <dc:date>2022-04-04T10:21:40Z</dc:date>
    <item>
      <title>Calculating UK National Insurance rates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2435293#M64969</link>
      <description>&lt;P&gt;Dear all,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;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 Insurance Category Letters following the below rate structures on a weekly basis.&amp;nbsp;&lt;img /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;My data is structured in daily shifts per employee with base salary [ActualCost] and NI Category in seperate coloums as seen below.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Initial idea is to do a SWIFT/IF statement related to a seperate NI Cateogry table, however I cant get my head around it as the daily costs needs to be summed into Weekly costs in order to calculate the correct NI payable.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you so much in advance.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 10:21:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2435293#M64969</guid>
      <dc:creator>Molin</dc:creator>
      <dc:date>2022-04-04T10:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating UK National Insurance rates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2435425#M64978</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="272412" data-lia-user-login="Molin" class="lia-mention lia-mention-user"&gt;Molin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can iterate ove the values of week number (preferably, year week number) in the date table. Example&lt;/P&gt;&lt;P&gt;SUMX (&lt;/P&gt;&lt;P&gt;VALUES (DateTable[YearWeek]),&lt;/P&gt;&lt;P&gt;CALCULATE (&lt;/P&gt;&lt;P&gt;SWITCH(&lt;/P&gt;&lt;P&gt;TRUE(),&lt;/P&gt;&lt;P&gt;SELECTEDVALUE(Table[NICategory])="A",&lt;/P&gt;&lt;P&gt;(SUM ( Table[ActualCost])-184)*0.12)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;ofcourse your calculation would be much more complicated. If you can sample file I migt be able to help you further. However, this is the general idea that you may follow. Other option is to use SUMMARIZE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 11:18:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2435425#M64978</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-04T11:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating UK National Insurance rates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2436575#M65049</link>
      <description>&lt;P&gt;Hi temerj1,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for helping out, that means alot! Iterating Year-Week number makes sense, however its getting quite complicated with the various ranges.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How do I send you a sample file?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 20:06:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2436575#M65049</guid>
      <dc:creator>Molin</dc:creator>
      <dc:date>2022-04-04T20:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating UK National Insurance rates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2436596#M65052</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="272412" data-lia-user-login="Molin" class="lia-mention lia-mention-user"&gt;Molin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can upload to WeTransfer for example and share the link.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 20:37:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2436596#M65052</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-04T20:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating UK National Insurance rates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2436616#M65054</link>
      <description>&lt;P&gt;Hi temerj1&lt;BR /&gt;&lt;BR /&gt;Here you go.&amp;nbsp;&lt;A href="https://we.tl/t-XVGmDP5uD9" target="_blank"&gt;https://we.tl/t-XVGmDP5uD9&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Again many thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 20:57:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2436616#M65054</guid>
      <dc:creator>Molin</dc:creator>
      <dc:date>2022-04-04T20:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating UK National Insurance rates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2436622#M65056</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="272412" data-lia-user-login="Molin" class="lia-mention lia-mention-user"&gt;Molin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great. Let me go through it. I'll get back to you soon.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 21:06:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2436622#M65056</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-04T21:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating UK National Insurance rates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2442713#M65467</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="272412" data-lia-user-login="Molin" class="lia-mention lia-mention-user"&gt;Molin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've checked your pbix file and there seems to be no better way.&lt;/P&gt;
&lt;P&gt;I'm afraid you have to calculate them according to different situations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Eason&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 08:20:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2442713#M65467</guid>
      <dc:creator>v-easonf-msft</dc:creator>
      <dc:date>2022-04-07T08:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating UK National Insurance rates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2486188#M68282</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="272412" data-lia-user-login="Molin" class="lia-mention lia-mention-user"&gt;Molin&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;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.&lt;BR /&gt;The first step was to import the tax lookup table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Then created the relationship.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Created the measures&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Actual Cost = SUM ( LaborCost[ActualCost] )&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;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 &amp;lt; 120, 0,
        Cost &amp;gt;= 120 &amp;amp;&amp;amp; Cost &amp;lt;= 184, ( Cost - 120 ) * R1,
        Cost &amp;gt; 184 &amp;amp;&amp;amp; Cost &amp;lt;= 967, 64 * R1 + ( Cost - 184 ) * R2,
        64 * R1 + 783 * R2 + ( Cost - 967 ) * R3 
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is how the report looks like&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 20:22:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-UK-National-Insurance-rates/m-p/2486188#M68282</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-29T20:22:39Z</dc:date>
    </item>
  </channel>
</rss>

