<?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 Fill in a measure value to all rows in a new measure by group in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3644281#M141110</link>
    <description>&lt;P&gt;Hi Members,&lt;/P&gt;&lt;P&gt;I'm working on a dashboard where I need to compute the ratio between two measures. To be more specific, I'd like to&lt;/P&gt;&lt;P&gt;get the ratio between Average Amount and Ref, both are measures, as shown in the screenshot. For each FY, the Ref&lt;/P&gt;&lt;P&gt;value is the one in the WI category (indicated by arrows). I managed to get the WI category value show up&lt;/P&gt;&lt;P&gt;in the Ref measure, but I am having difficulties&amp;nbsp;to populate the value by FY group. My case is a bit complicated because&lt;/P&gt;&lt;P&gt;I need to use slicers on FY/Size/Category to showcase the ratio in various scenarios. In the screenshot, Total Amount,&lt;/P&gt;&lt;P&gt;Total Order, Average Amount are all measures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did a little bit of search and came across three cases that are very close to my situation:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/Use-a-measure-value-of-one-row-to-populate-all-other-rows/td-p/2449283" target="_self"&gt;Use a measure value of one row to populate all other rows&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/New-measure-to-take-the-value-from-1-row-and-apply-it-to-all/m-p/692741" target="_self"&gt;New measure to take the value from 1 row and apply it to all rows in the table&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/Divide-Measure-by-its-Max-value/td-p/2329187" target="_self"&gt;Divide Measure by its Max value&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;However none of the solutions work in my case. It'd be appreciated if experts here could help me find a solutuon.&lt;/P&gt;&lt;P&gt;Thank you for your time!&lt;/P&gt;&lt;P&gt;-------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Sample PBIX file:&lt;/FONT&gt; &lt;A href="https://1drv.ms/u/s!Am2OQer9U8V3hULbeYuAUu4SgNxc?e=feRl1E" target="_blank" rel="noopener"&gt;filter_test.pbix&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Sample data:&lt;/FONT&gt; &lt;A href="https://1drv.ms/u/s!Am2OQer9U8V3hUHMOiRPqVAVtQ0S?e=Eb6KVf" target="_self"&gt;Sample.csv&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jan 2024 20:06:59 GMT</pubDate>
    <dc:creator>RandomWalker</dc:creator>
    <dc:date>2024-01-17T20:06:59Z</dc:date>
    <item>
      <title>Fill in a measure value to all rows in a new measure by group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3644281#M141110</link>
      <description>&lt;P&gt;Hi Members,&lt;/P&gt;&lt;P&gt;I'm working on a dashboard where I need to compute the ratio between two measures. To be more specific, I'd like to&lt;/P&gt;&lt;P&gt;get the ratio between Average Amount and Ref, both are measures, as shown in the screenshot. For each FY, the Ref&lt;/P&gt;&lt;P&gt;value is the one in the WI category (indicated by arrows). I managed to get the WI category value show up&lt;/P&gt;&lt;P&gt;in the Ref measure, but I am having difficulties&amp;nbsp;to populate the value by FY group. My case is a bit complicated because&lt;/P&gt;&lt;P&gt;I need to use slicers on FY/Size/Category to showcase the ratio in various scenarios. In the screenshot, Total Amount,&lt;/P&gt;&lt;P&gt;Total Order, Average Amount are all measures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did a little bit of search and came across three cases that are very close to my situation:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/Use-a-measure-value-of-one-row-to-populate-all-other-rows/td-p/2449283" target="_self"&gt;Use a measure value of one row to populate all other rows&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/New-measure-to-take-the-value-from-1-row-and-apply-it-to-all/m-p/692741" target="_self"&gt;New measure to take the value from 1 row and apply it to all rows in the table&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/Divide-Measure-by-its-Max-value/td-p/2329187" target="_self"&gt;Divide Measure by its Max value&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;However none of the solutions work in my case. It'd be appreciated if experts here could help me find a solutuon.&lt;/P&gt;&lt;P&gt;Thank you for your time!&lt;/P&gt;&lt;P&gt;-------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Sample PBIX file:&lt;/FONT&gt; &lt;A href="https://1drv.ms/u/s!Am2OQer9U8V3hULbeYuAUu4SgNxc?e=feRl1E" target="_blank" rel="noopener"&gt;filter_test.pbix&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Sample data:&lt;/FONT&gt; &lt;A href="https://1drv.ms/u/s!Am2OQer9U8V3hUHMOiRPqVAVtQ0S?e=Eb6KVf" target="_self"&gt;Sample.csv&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 20:06:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3644281#M141110</guid>
      <dc:creator>RandomWalker</dc:creator>
      <dc:date>2024-01-17T20:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in a measure value to all rows in a new measure by group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3644519#M141117</link>
      <description>&lt;P&gt;I think I'm getting there but not quite yet. Inspired by &lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-fill-each-row-of-a-measure-based-on-a-single-row-value/m-p/2368245" target="_self"&gt;this post&lt;/A&gt;, it seems that with this Ref measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Ref = 
    CALCULATE(
        [Avg Amount],
        FILTER(
            ALLSELECTED(Sample),
            Sample[Category] = "WI"
        ),
        VALUES(Sample[FY])
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to propagate the value of category WI to the rows by FY:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&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;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;However, this measure does not play well with the Category slicer.&amp;nbsp;For example, if OT is selected in the silcer, Ref column is empty and the ratio is not correct:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 23:31:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3644519#M141117</guid>
      <dc:creator>RandomWalker</dc:creator>
      <dc:date>2024-01-17T23:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in a measure value to all rows in a new measure by group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3645255#M141140</link>
      <description>&lt;P&gt;&lt;U&gt;Note: the following is not strictly a DAX solution, it's just a workaround based on data model change.&lt;/U&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After some thougts, I decided to change the data model by adding two more columns for WI category Order and Amount data in each group. (You could find the original data in the link above)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this structure, it becomes straightforward to just compute Total Amount, Total Order, and Ave Amount measures using these DAX expressions:&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;Tot Amount = 
    SUMX(
        KEEPFILTERS(VALUES(Sample[Amount])),
        CALCULATE(
            SUM(Sample[Amount])
        )
    )

Tot Order = 
    SUMX(KEEPFILTERS(VALUES(Sample[Order])), CALCULATE(SUM(Sample[Order])))


Avg Amount = 
VAR _amt = 
    SUMX( KEEPFILTERS(VALUES(Sample[Amount])), CALCULATE(SUM(Sample[Amount])) )
VAR _order = 
    SUMX( KEEPFILTERS(VALUES(Sample[Order])), CALCULATE(SUM(Sample[Order])) )
RETURN
    DIVIDE( _amt, _order)&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;Then I just create the same measure (with the WI category data) for the added wOrder and wAmount columns in the new data model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;With this data structure modification, the calculation of ratio becomes trivial and the results plays very well with slicers:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 07:54:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3645255#M141140</guid>
      <dc:creator>RandomWalker</dc:creator>
      <dc:date>2024-01-18T07:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in a measure value to all rows in a new measure by group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3645440#M141151</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="619691" data-lia-user-login="RandomWalker" class="lia-mention lia-mention-user"&gt;RandomWalker&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for sharing!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jayleny&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 09:03:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Fill-in-a-measure-value-to-all-rows-in-a-new-measure-by-group/m-p/3645440#M141151</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-18T09:03:39Z</dc:date>
    </item>
  </channel>
</rss>

