<?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 Re: Calculating Turnover with a split in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2772498#M86360</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="316624" data-lia-user-login="andyor" class="lia-mention lia-mention-user"&gt;andyor&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I'm a little confused about your needs, Could you please explain them further?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your efforts &amp;amp; time in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Binbin Yu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 06:53:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-09-16T06:53:19Z</dc:date>
    <item>
      <title>Calculating Turnover with a split</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2768976#M86109</link>
      <description>&lt;P&gt;I have several rows in my dataset where the Turnover field needs to be split up into 3/4/5/6/7 parts, depending.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I face is that if say the turnover is $200 and I need to split it into 3 parts, this will assign $66.67 for each = $200.01, which isn't right.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know what I want to do out loud, but just don't know how to implement this in DAX.&amp;nbsp;I'm thinking of calculating the sum of the parts thereafter, such that if the sum of the parts != to the original number, then subtract this from the first row with that ID. But there could be a more elegant way of doing this too!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example rows below, before and (hopefully) after.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate if anybody can help with this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ID	RecordType	Turnover
2456	1	$200.00
2456	0	$0.00
2456	0	$0.00
		
ID	RecordType	Turnover
2456	1	$66.66
2456	0	$66.67
2456	0	$66.67&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 05:23:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2768976#M86109</guid>
      <dc:creator>andyor</dc:creator>
      <dc:date>2022-09-15T05:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Turnover with a split</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2772498#M86360</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="316624" data-lia-user-login="andyor" class="lia-mention lia-mention-user"&gt;andyor&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I'm a little confused about your needs, Could you please explain them further?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your efforts &amp;amp; time in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Binbin Yu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 06:53:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2772498#M86360</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-16T06:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Turnover with a split</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2772667#M86371</link>
      <description>&lt;P&gt;3 more examples below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nothing needs to be done with examples 1 and 3. But for example 2, since $350/6 rows with that same (row) ID calculates as $58.33 = $349.98. So we need to add on $0.02 to the row where RecordType = 1 to keep the same amount.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same as the original example, $200/3 rows with the same ID = $66.67. This totals $200.01. So we needed to subtract $0.01 from RecordType = 1 .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ID	RecordType	Turnover
2457	1	$200.00
2457	0	$0.00
2457	0	$0.00
2457	0	$0.00

ID	RecordType	Turnover
2457	1	$50.00
2457	0	$50.00
2457	0	$50.00
2457	0	$50.00&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ID	RecordType	Turnover
2458	1	$350.00
2458	0	$0.00
2458	0	$0.00
2458	0	$0.00
2458	0	$0.00
2458	0	$0.00

ID	RecordType	Turnover
2458	1	$58.35
2458	0	$58.33
2458	0	$58.33
2458	0	$58.33
2458	0	$58.33
2458	0	$58.33&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ID	RecordType	Turnover
2459	1	$100.00
2459	0	$0.00

ID	RecordType	Turnover
2459	1	$50.00
2459	0	$50.00&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 07:45:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2772667#M86371</guid>
      <dc:creator>andyor</dc:creator>
      <dc:date>2022-09-16T07:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Turnover with a split</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2772897#M86393</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="316624" data-lia-user-login="andyor" class="lia-mention lia-mention-user"&gt;andyor&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please try below steps:&lt;/P&gt;
&lt;P&gt;1. below is my test table&lt;/P&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. create a measure and add it to table visual&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Avg Tuno =
VAR cur_id =
    SELECTEDVALUE ( 'Table'[ID] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[ID] = cur_id )
VAR ctn =
    COUNTROWS ( tmp )
VAR max_tuno =
    MAXX ( tmp, [Turnover] )
RETURN
    DIVIDE ( max_tuno, ctn )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Measure =
VAR cur_id =
    SELECTEDVALUE ( 'Table'[ID] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[ID] = cur_id )
VAR max_tuno =
    MAXX ( tmp, [Turnover] )
VAR ctn =
    COUNTROWS ( tmp )
VAR _a =
    FORMAT ( [Avg Tuno], "0.00" )
VAR diff = ctn * _a - max_tuno
RETURN
    IF (
        diff &amp;gt; 0,
        IF ( SELECTEDVALUE ( 'Table'[RecordType] ) = 1, _a - diff, _a ),
        IF ( SELECTEDVALUE ( 'Table'[RecordType] ) = 1, _a + diff, _a )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Please refer the attached .pbix file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Binbin Yu&lt;BR /&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 08:59:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Turnover-with-a-split/m-p/2772897#M86393</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-16T08:59:01Z</dc:date>
    </item>
  </channel>
</rss>

