<?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 GEOMEAN on roll up and roll down basis based on several columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2481089#M67904</link>
    <description>&lt;P&gt;So the following DAX code worked for me.&lt;/P&gt;&lt;LI-CODE lang="php"&gt;VAR CurrMonth = MAX ( 'Table'[Date] )
RETURN
    PRODUCTX (
        CALCULATETABLE ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] &amp;lt;= CurrMonth ),
            CALCULATE ( [GeoMean])
    )&lt;/LI-CODE&gt;&lt;P&gt;Your suggestion for using PRODUCTX worked for me. Thanks a lot for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Apr 2022 17:13:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-04-27T17:13:15Z</dc:date>
    <item>
      <title>Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2472293#M67376</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;Apologies for a lengthy question but I got stuck badly in a project. I am trying to calculate GEOMEAN of column, based on other columns on a roll up and roll down basis. To elaborate further, I have a table with following columns and I am trying to calculate some price movements. I have a table with following columns:&lt;/P&gt;&lt;P&gt;Date, Brand, Product Category Code, Product Category Description, Prod Sub Category, Prod Sub Category Description, City, Region, Province/State and Relative. All columns have "text" data type except for Date (Date type) and Relative (integer).&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;&lt;A href="https://uofc-my.sharepoint.com/:x:/r/personal/kamran_imam_ucalgary_ca/Documents/Example.xlsx?d=w975c18857d54447dbd9b867ddd95acbf&amp;amp;csf=1&amp;amp;web=1&amp;amp;e=ERsrPI" target="_self"&gt;Example Data&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is to calculate the GEOMEAN of relative column at each timestep and with respect to each entry in Brand, Product Category Code, Product Category Description, Prod Sub Category, Prod Sub Category Description, City, Region, Province/State in such a way that in a visual, if I want to drill down to Product Sub Category Code level, it will calculate a GEOMEAN of each product sub category level for each, city, region state etc. Similarly, if I select a higher level hierarchy i.e. Product Category Code, it gives a GEOMEAN of all Product Sub Categories within the Product Category for each city region state etc. Similarly, it gives me GEOMEAN if I want to roll up to State level or want to roll down to city level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once, I have the GEOMEAN in the manner described above for a given Date, I would then need it to multiply with the GEOMEAN of the previous Date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code to calculate the desired measure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;measure =&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calculate (GEOMEAN('Table'[Relative]),&lt;/P&gt;&lt;P&gt;FILTER(ALLEXCEPT(&lt;/P&gt;&lt;P&gt;'Table',&lt;/P&gt;&lt;P&gt;'Table'[Brand],&amp;nbsp;'Table'[Product Category Code],&amp;nbsp;'Table'[Product Category Description],&lt;/P&gt;&lt;P&gt;'Table'[Product Sub Category Code],&amp;nbsp;'Table'[Product Sub Category Description],&amp;nbsp;'Table'[City],&amp;nbsp;'Table'[Region],&lt;/P&gt;&lt;P&gt;'Table'[Province/State]),&lt;/P&gt;&lt;P&gt;'Table'[Date] = Max('Table'[Date])))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then try to multiply the measure calculated at a given time step with the previous time step by using following code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;desired_results =&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calculate (Product('Table'[measure]),&lt;/P&gt;&lt;P&gt;FILTER(ALLEXCEPT(&lt;/P&gt;&lt;P&gt;'Table',&lt;/P&gt;&lt;P&gt;'Table'[Brand],&amp;nbsp;'Table'[Product Category Code],&amp;nbsp;'Table'[Product Category Description],&lt;/P&gt;&lt;P&gt;'Table'[Product Sub Category Code],&amp;nbsp;'Table'[Product Sub Category Description],&amp;nbsp;'Table'[City],&amp;nbsp;'Table'[Region],&lt;/P&gt;&lt;P&gt;'Table'[Province/State]),&lt;/P&gt;&lt;P&gt;'Table'[Date] &amp;lt;= Max('Table'[Date])))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I don't get the desired result because, function Product does not take measure as an input and when I try to calculate a column in the first step instead of measure I get blanks. Not sure how to get around the issue. Your help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 20:10:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2472293#M67376</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-22T20:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2473365#M67461</link>
      <description>&lt;P&gt;What do you mean by "previous time step"? Your desired_results measure looks to be including all dates up to and including the current time step. What is the purpose of your intended desired measure?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FYI, I cannot access the example data you link to.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Apr 2022 17:59:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2473365#M67461</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-04-24T17:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2475530#M67572</link>
      <description>&lt;P&gt;Thanks for your question Alexis. Let me elaborate further regarding current and previous time step. So for example, if I am looking at the month of April 2021, then April 2021 is current time step and March 2021 is previous time step. So the GEOMEAN of Relative column for April 2021 gets multiplied by GEOMEAN of Relatives from March 2021 and in the previous time step, GEOMEAN of March 2021 was multiplied by GEOMEAN of Februrary 2021.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in February the result would be GEOMEAN[RELATIVE in Jan 2021] * GEOMEAN[RELATIVE in Feb 2021] = X1.&lt;/P&gt;&lt;P&gt;In March the result would be GEOMEAN[RELATIVE in Mar 2021] * X1 = X2&lt;/P&gt;&lt;P&gt;In April the result would be GEOMEAN[RELATIVE in Apr 2021]*X2 = X3&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://uofc-my.sharepoint.com/:x:/g/personal/kamran_imam_ucalgary_ca/EYUYXJdUfX1EvZuGfd2VrL8BB9E7Mid7yLes1FMHgUyiyA?e=6AsZCQ" target="_self"&gt;Example.xlsx&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies about the link not working. You may try it now. Appreciate your help.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 16:08:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2475530#M67572</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-25T16:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2475583#M67581</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;[GeoMean] * CALCULATE ( [GeoMean], DATEADD ( 'Table'[Date], -1, MONTH ) )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Apr 2022 16:39:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2475583#M67581</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-04-25T16:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2475917#M67595</link>
      <description>&lt;P&gt;Its actually close but not exactly what I am looking for. Let me elaborate below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Relative&lt;/TD&gt;&lt;TD&gt;Result I am Getting&lt;/TD&gt;&lt;TD&gt;Result I want&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jan 21&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Feb 21&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Mar 21&lt;/TD&gt;&lt;TD&gt;1.2&lt;/TD&gt;&lt;TD&gt;1.2&lt;/TD&gt;&lt;TD&gt;1.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Apr 21&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1.2&lt;/TD&gt;&lt;TD&gt;1.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;May 21&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1.2&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So basically, the current month value in column "Relative" needs to be multiplied with its previous month value and "stored" in the "Desired Result" column for the current month, then the next month value in the column Relative needs to be multiplied with previous month 'Desired Result' value. If you focus on the month of May, that's the problem I am having. Appreciate if you could help resolve it.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 19:53:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2475917#M67595</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-25T19:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2476082#M67616</link>
      <description>&lt;P&gt;Ah, you're defining it recursively so you do need a cumulative calculation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;VAR CurrMonth = MAX ( 'Table'[Date] )
RETURN
    PRODUCTX (
        CALCULATETABLE ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] &amp;lt;= CurrMonth ),
        VAR MonthDiff = DATEDIFF ( 'Table'[Date], CurrMonth, MONTH )
        RETURN
            CALCULATE ( [GeoMean], DATEADD ( 'Table'[Date], MonthDiff, MONTH ) )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Apr 2022 21:47:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2476082#M67616</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-04-25T21:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2479651#M67822</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your [&lt;SPAN&gt;desired_results&lt;/SPAN&gt;] measure is close. You get error due to you add a measure into &lt;A href="https://docs.microsoft.com/en-us/dax/product-function-dax" target="_self"&gt;PRODUCT&lt;/A&gt; function. It needs a column instead a measure. You can try&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/dax/productx-function-dax" target="_self"&gt;PRODUCTX&lt;/A&gt; to achieve your goal.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;desired_results = 
CALCULATE (
    PRODUCTX ( VALUES ( 'Table'[Date] ), [Measure] ),
    FILTER (
        ALLEXCEPT (
            'Table',
            'Table'[Brand],
            'Table'[Product Category Code],
            'Table'[Product Category Description],
            'Table'[Prod Sub Category Code],
            'Table'[Prod Sub Category Description],
            'Table'[City],
            'Table'[Region],
            'Table'[Province/State]
        ),
        'Table'[Date] &amp;lt;= MAX ( 'Table'[Date] )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 07:25:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2479651#M67822</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-27T07:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2481089#M67904</link>
      <description>&lt;P&gt;So the following DAX code worked for me.&lt;/P&gt;&lt;LI-CODE lang="php"&gt;VAR CurrMonth = MAX ( 'Table'[Date] )
RETURN
    PRODUCTX (
        CALCULATETABLE ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] &amp;lt;= CurrMonth ),
            CALCULATE ( [GeoMean])
    )&lt;/LI-CODE&gt;&lt;P&gt;Your suggestion for using PRODUCTX worked for me. Thanks a lot for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 17:13:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2481089#M67904</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-27T17:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2481093#M67905</link>
      <description>&lt;P&gt;Thanks Rico! It worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 17:14:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2481093#M67905</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-27T17:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating GEOMEAN on roll up and roll down basis based on several columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2481288#M67924</link>
      <description>&lt;P&gt;Ah. Good call. You don't need the DATEADD if you use the date row context.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 19:00:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-GEOMEAN-on-roll-up-and-roll-down-basis-based-on/m-p/2481288#M67924</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-04-27T19:00:26Z</dc:date>
    </item>
  </channel>
</rss>

