<?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: Returning the average of known values for all blank values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Returning-the-average-of-known-values-for-all-blank-values/m-p/3075872#M106938</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total emissions measure: = 
VAR _emissionavg =
    CALCULATE ( AVERAGE ( Data[Emissions] ), ALL ( Data[Dimension] ) )
RETURN
    SUMX (
        SUMMARIZE ( Data, Data[SKU], Data[Dimension] ),
        CALCULATE (
            IF (
                ISBLANK ( MAX ( Data[Emissions] ) ),
                _emissionavg * SELECTEDVALUE( Data[Qty bought] ),
                SUMX( Data, Data[Emissions] * Data[Qty bought] )
            )
        )
    )&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 11 Feb 2023 05:03:40 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2023-02-11T05:03:40Z</dc:date>
    <item>
      <title>Returning the average of known values for all blank values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Returning-the-average-of-known-values-for-all-blank-values/m-p/3074903#M106883</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I am looking for an expert that can help me with a dax formula to calculate the average of some known values in a column and then return that average in the rows where there is no value present.&lt;BR /&gt;&lt;BR /&gt;I have a matrix visual with data similar to the below&lt;BR /&gt;&lt;BR /&gt;The reason for why there are missing emission values is caused by a relationship between the emission and dimension table. I still want to calculate the total emissions (Emissions*Qty bought) for those rows where no emission data is available using the average emissions from the other suppliers.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SKU&lt;/TD&gt;&lt;TD&gt;Dimension&lt;/TD&gt;&lt;TD&gt;Emissions&lt;/TD&gt;&lt;TD&gt;Qty bought&lt;/TD&gt;&lt;TD&gt;Value to be returned&lt;/TD&gt;&lt;TD&gt;Total emissions&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;U123&lt;/TD&gt;&lt;TD&gt;Supplier 1&lt;/TD&gt;&lt;TD&gt;0,5&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;0,5&lt;/TD&gt;&lt;TD&gt;0,5*100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;U123&lt;/TD&gt;&lt;TD&gt;Supplier 2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;AVERAGE(0,5+0,6+0,7) = 0,6&lt;/TD&gt;&lt;TD&gt;0,6*200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;U123&lt;/TD&gt;&lt;TD&gt;Supplier 3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;AVERAGE(0,5+0,6+0,7) = 0,6&lt;/TD&gt;&lt;TD&gt;0,6*300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;U123&lt;/TD&gt;&lt;TD&gt;Supplier 4&lt;/TD&gt;&lt;TD&gt;0,6&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;0,6&lt;/TD&gt;&lt;TD&gt;0,6*200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;U123&lt;/TD&gt;&lt;TD&gt;Supplier 5&lt;/TD&gt;&lt;TD&gt;0,7&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;0,7&lt;/TD&gt;&lt;TD&gt;0,7*200&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 10 Feb 2023 15:25:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Returning-the-average-of-known-values-for-all-blank-values/m-p/3074903#M106883</guid>
      <dc:creator>fhoe</dc:creator>
      <dc:date>2023-02-10T15:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Returning the average of known values for all blank values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Returning-the-average-of-known-values-for-all-blank-values/m-p/3075872#M106938</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total emissions measure: = 
VAR _emissionavg =
    CALCULATE ( AVERAGE ( Data[Emissions] ), ALL ( Data[Dimension] ) )
RETURN
    SUMX (
        SUMMARIZE ( Data, Data[SKU], Data[Dimension] ),
        CALCULATE (
            IF (
                ISBLANK ( MAX ( Data[Emissions] ) ),
                _emissionavg * SELECTEDVALUE( Data[Qty bought] ),
                SUMX( Data, Data[Emissions] * Data[Qty bought] )
            )
        )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 11 Feb 2023 05:03:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Returning-the-average-of-known-values-for-all-blank-values/m-p/3075872#M106938</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-02-11T05:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Returning the average of known values for all blank values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Returning-the-average-of-known-values-for-all-blank-values/m-p/3077618#M107060</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Appreciate the support!&lt;BR /&gt;&lt;BR /&gt;I tried the DAX code and while it is correctly returning the total emissions for those rows where there is a value present, it shows nothing for blank rows.&lt;BR /&gt;&lt;BR /&gt;The datamodel consists of four tables:&lt;BR /&gt;1. "Emission factor" where the column "emissions" comes from&lt;BR /&gt;2. "Item classification" that has a relationship to the SKU column from emisssion factor table&lt;BR /&gt;3. "PO data" that has a relationship to the SKU column from item classification table. PO data table provides the quantity in the table as a simple DAX measure.&lt;BR /&gt;4. "Dimension" which has a relationship to both PO data and emission factor through the rows in the dimension column.&lt;BR /&gt;&lt;BR /&gt;The blank rows in the table are created by the relationship where there are no emission data for a given supplier, but where there are quantity data. It would be great if the measure could just return the average emissions for each SKU in the instances where there are no data in the emissions field. Like I pointed out in the table.&lt;BR /&gt;&lt;BR /&gt;Please let me know if this makes sense. Thank you so much&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 11:24:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Returning-the-average-of-known-values-for-all-blank-values/m-p/3077618#M107060</guid>
      <dc:creator>fhoe</dc:creator>
      <dc:date>2023-02-13T11:24:00Z</dc:date>
    </item>
  </channel>
</rss>

