<?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 Changes on the fly between two tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304458#M170922</link>
    <description>&lt;P&gt;Ok, so I was overthinking this a little bit and that has helped. The problem is, when I filter it by the item, it removes all Names that aren't related to that Item.&amp;nbsp;&lt;BR /&gt;So the overall averages work a treat if all items are selected.&amp;nbsp; but the problem comes when I filter it. so I do have a table with just the names in it, which has links to both the scores and the uplifts tables. so if i do all the calculations within the names table, but the filter is based on the items in uplifts, it removes any item in the names table that doesn't have that item. and then averages are just the averages of those items, not all items with those uplifts.&amp;nbsp;&lt;BR /&gt;for the example above, that means I'm getting: an average of 2 with no uplifts - great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if I do all scores + all uplifts / count of rows = 2.5&amp;nbsp; - great &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but then if i filter the visual to just show me items 1+2, that's giving me the average of (2.5+3.5)/2 = 3&amp;nbsp; whereas it should be 2.4 - it's ignoring the Names of stuff that doesn't have that mapping. and short of mapping every Item to every Name with a value of 0 which is kinda crazy and would be a very very big table, i'm not sure how to get to the average i'm looking for?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Nov 2024 15:05:09 GMT</pubDate>
    <dc:creator>zantarel</dc:creator>
    <dc:date>2024-11-27T15:05:09Z</dc:date>
    <item>
      <title>Calculating Changes on the fly between two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304380#M170914</link>
      <description>&lt;P&gt;Hi all&amp;nbsp;&lt;/P&gt;&lt;P&gt;Been struggling with this one and hoping someone can help ... so I've got a couple of Tables - let's call them Scores and Uplifts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Scores:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Score&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG&gt;Uplifts:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Score Uplift&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 2&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1.0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 1&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 3&lt;/TD&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is calculate the the averages of the numbers, based on the 'Item' selected.&amp;nbsp;&lt;BR /&gt;The current average is easy - just Average (NumberColumn) = (2+2+1+3+2)/5 = 2&lt;BR /&gt;&lt;BR /&gt;But then I want a way of saying based on the Items selected, the new average would be: XX&amp;nbsp;&lt;BR /&gt;i.e. Selecting Item 1 and 2, the new average would be: ((2+0.5+1)+(2+0.5)+1+3+2 )/6= 2.4&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Because Items 1 and 2 both affect A, so both of their uplifts need to be added to A. Whereas B is only being uplifted by Item 1, and I've not selected Item 3, so that uplift of 0.5 hasn't been included.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do this as a calculated column, I can easily lookup the score value and add the uplift onto that, but then when I average that, the original score essentially gets added twice - i.e. I'd end up with the below, which gives a different average, and then when I select only Items 1 and 2, the average score will just be those scores, not all scores but just those uplifts.&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Score Uplift&lt;/TD&gt;&lt;TD&gt;original Score&lt;/TD&gt;&lt;TD&gt;Uplifted score&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 2&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1.0&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 1&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 3&lt;/TD&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I don't seem to be able to get this to work at all and my brain just can't work out the logic I need to do this in a measure... I hope this makes sense...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 14:30:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304380#M170914</guid>
      <dc:creator>zantarel</dc:creator>
      <dc:date>2024-11-27T14:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Changes on the fly between two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304395#M170916</link>
      <description>&lt;P&gt;If you have a separate table of the names, which links to both scores and uplifts, you can use that in the visual and write a measure like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Combined Average =
DIVIDE (
    SUM ( Scores[Score] ) + SUM ( Uplifts[Score Uplift] ),
    COUNTROWS ( Scores ) + COUNTROWS ( Uplifts )
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Nov 2024 14:30:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304395#M170916</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-11-27T14:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Changes on the fly between two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304431#M170918</link>
      <description>&lt;P&gt;hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="595133" data-lia-user-login="zantarel" class="lia-mention lia-mention-user"&gt;zantarel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try like:&lt;/P&gt;
&lt;P&gt;measure =&lt;/P&gt;
&lt;P&gt;DIVIDE(&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; SUM(uplifts[score uplift]) + SUM(scores[score]),&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; DISTINCTCOUNT(scores[name])&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 14:51:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304431#M170918</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2024-11-27T14:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Changes on the fly between two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304458#M170922</link>
      <description>&lt;P&gt;Ok, so I was overthinking this a little bit and that has helped. The problem is, when I filter it by the item, it removes all Names that aren't related to that Item.&amp;nbsp;&lt;BR /&gt;So the overall averages work a treat if all items are selected.&amp;nbsp; but the problem comes when I filter it. so I do have a table with just the names in it, which has links to both the scores and the uplifts tables. so if i do all the calculations within the names table, but the filter is based on the items in uplifts, it removes any item in the names table that doesn't have that item. and then averages are just the averages of those items, not all items with those uplifts.&amp;nbsp;&lt;BR /&gt;for the example above, that means I'm getting: an average of 2 with no uplifts - great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if I do all scores + all uplifts / count of rows = 2.5&amp;nbsp; - great &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but then if i filter the visual to just show me items 1+2, that's giving me the average of (2.5+3.5)/2 = 3&amp;nbsp; whereas it should be 2.4 - it's ignoring the Names of stuff that doesn't have that mapping. and short of mapping every Item to every Name with a value of 0 which is kinda crazy and would be a very very big table, i'm not sure how to get to the average i'm looking for?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 15:05:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304458#M170922</guid>
      <dc:creator>zantarel</dc:creator>
      <dc:date>2024-11-27T15:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Changes on the fly between two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304657#M170929</link>
      <description>&lt;P&gt;It sounds like either there's a relationship between scores and uplifts, which there shouldn't be, or the relationship between the names table and uplift is bi-directional, which it shouldn't be. The relationship from names to both tables and uplift should be single direction so that names filters the other tables, but the other tables do not filter names.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 16:45:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304657#M170929</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-11-27T16:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Changes on the fly between two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304688#M170930</link>
      <description>&lt;P&gt;oh! I forgot about the relationships part of it... I think I've got it then! Thank you so much!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 17:06:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Changes-on-the-fly-between-two-tables/m-p/4304688#M170930</guid>
      <dc:creator>zantarel</dc:creator>
      <dc:date>2024-11-27T17:06:01Z</dc:date>
    </item>
  </channel>
</rss>

