<?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: Issue with meaure total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921182#M9092</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="178387" data-lia-user-login="Tommyvhod" class="lia-mention lia-mention-user"&gt;Tommyvhod&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below one may work for you, but it might be a bit slow&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum = 
	SUMX(
		KEEPFILTERS(Values(Data[Operacia]))
	,
		CALCULATE([allsum])
	)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2020 12:35:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-02-04T12:35:16Z</dc:date>
    <item>
      <title>Issue with meaure total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/916289#M8888</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;I created a measure to make a weighted average in production. The formula works but the total of measure is not correct.&lt;/P&gt;&lt;P&gt;I have found multiple topics about this but I was unable to modify the formula based on those samples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is that all work stations has multiple part IDs , I divided the total times with the distinct IDs ( or if the final work station has more IDs like the actual work station than with that.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is OK for each work stations ( Operacia) , they seems to have 160 distinct IDs maximum, but in total it counts 220 IDs trough all work stations and divides the total time with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal would be to sum each work stations result( yellow) and not the last all time / all distinct IDs ( red)&lt;/P&gt;&lt;P&gt;I hope you understand it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dax:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;allsum = VAR _Max = MAXX(ALLSELECTED(Data);Data[Operacia])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DIVIDE(SUM(Data[Act time]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF(CALCULATE(DISTINCTCOUNT(Data[ID]);Data[Operacia]) &amp;gt;CALCULATE(DISTINCTCOUNT(Data[ID]);Data[Operacia] = _Max);CALCULATE(DISTINCTCOUNT(Data[ID]);Data[Operacia]);CALCULATE(DISTINCTCOUNT(Data[ID]);Data[Operacia] = _Max) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 09:51:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/916289#M8888</guid>
      <dc:creator>Tommyvhod</dc:creator>
      <dc:date>2020-01-30T09:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with meaure total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/919375#M9024</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="178387" data-lia-user-login="Tommyvhod" class="lia-mention lia-mention-user"&gt;Tommyvhod&lt;/a&gt;, can you to create a new measure like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Allsum Final =
IF ( HASONEVALUE ( Data[Operacia] ); [allsum]; SUMX ( data; [allsum] ) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;Sturla&lt;BR /&gt;&lt;BR /&gt;If this post helps, then please consider Accepting it as the solution. Kudos are nice too.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 09:11:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/919375#M9024</guid>
      <dc:creator>sturlaws</dc:creator>
      <dc:date>2020-02-03T09:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with meaure total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921129#M9089</link>
      <description>&lt;P&gt;I added the formula, indeed i tryed similar one earlier. But I get a 1,63K final result. The reality should be around 10.5h&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 11:41:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921129#M9089</guid>
      <dc:creator>Tommyvhod</dc:creator>
      <dc:date>2020-02-04T11:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with meaure total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921182#M9092</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="178387" data-lia-user-login="Tommyvhod" class="lia-mention lia-mention-user"&gt;Tommyvhod&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below one may work for you, but it might be a bit slow&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum = 
	SUMX(
		KEEPFILTERS(Values(Data[Operacia]))
	,
		CALCULATE([allsum])
	)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 12:35:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921182#M9092</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-04T12:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with meaure total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921185#M9093</link>
      <description>&lt;P&gt;I added this one as well, but it seems to have the same result as [allsum] 7.40&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 12:38:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921185#M9093</guid>
      <dc:creator>Tommyvhod</dc:creator>
      <dc:date>2020-02-04T12:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with meaure total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921259#M9096</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="178387" data-lia-user-login="Tommyvhod" class="lia-mention lia-mention-user"&gt;Tommyvhod&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry did not notice that this is baiscally weitghted average.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the division is Allsum then it should look like that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;VAR __CATEGORY_VALUES = VALUES('Data'[Operacia])
RETURN
	DIVIDE(
		SUMX(
			KEEPFILTERS(__CATEGORY_VALUES),
			CALCULATE([Count of IDs] * [allsum])
		),
		SUMX(KEEPFILTERS(__CATEGORY_VALUES), CALCULATE([allsum]))
	)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am not sure if this is an expected result so if there is a need to have it other way around...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;VAR __CATEGORY_VALUES = VALUES('Data'[Operacia])
RETURN
	DIVIDE(
		SUMX(
			KEEPFILTERS(__CATEGORY_VALUES),
			CALCULATE([allsum] * [Count of IDs])
		),
		SUMX(
			KEEPFILTERS(__CATEGORY_VALUES),
			CALCULATE([Count of IDs])
		)
	)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you may need to refine it... so what "SUMX(KEEPFILTERS(VALUES([Column])),Calculate([Measure])) does... basicaly it pre-calculates values per specified column and sums results up, not relying on Total values.&amp;nbsp; so [allsum]*[Count of IDs] here will get result for each "Operatia" first and then sum up results from individual calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rest is just placing proper numerator, denominator to get the results.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 13:43:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/921259#M9096</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-04T13:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with meaure total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/922157#M9129</link>
      <description>&lt;P&gt;I added both formulas. I was unsure about how you got the count of IDs so I replaced it with distinctcount(Data[ID])&lt;/P&gt;&lt;P&gt;The result for the first is 0.2927&lt;/P&gt;&lt;P&gt;fr the second there is an error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe the replacement of count of ids is wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 07:58:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-meaure-total/m-p/922157#M9129</guid>
      <dc:creator>Tommyvhod</dc:creator>
      <dc:date>2020-02-05T07:58:00Z</dc:date>
    </item>
  </channel>
</rss>

