<?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: LOD to DAX conversion in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2621921#M76402</link>
    <description>&lt;P&gt;Scenario1: I havent selected any year from the year slicer and now PY year is coming for me, also I have hardcoded the previous year as 2021.&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*******&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scenario2:&lt;/P&gt;&lt;P&gt;When I have selected an year from the Base year slicer, PY value will vanish either using hardcode or using a variable also. I have also included your solution, but its coming unique value for all. But i should get the PY year value as show with the hard code value&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;You may also see this coming when i remove country from the table, as i dont need to show it.&amp;nbsp;&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;I will anyway be using country filter for my main dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest me what needs to be done here. I don't think this filter(all(table_name) is required here. but when I am removing this . I am getting blank here as well&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jul 2022 09:07:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-07-06T09:07:24Z</dc:date>
    <item>
      <title>LOD to DAX conversion</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2587379#M74448</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Hi Guys,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I hope you all are doing well.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am working on a Tableau to Power Bi migration project and stuck in yet another calculation.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I want to convert one LOD to Dax in power BI. Below the the Tableau LOD calculation:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;{&lt;/STRONG&gt; &lt;STRONG&gt;FIXED [Parts Id]:sum({ FIXED [Parts Id],[Part Number],[Country]: AVG(if [Year] = int([ParamYear])-1 then [Vol] end )})}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried to use below Calculation in Power BI&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Var yr= SELECTEDVALUE(CC[Param_year]) return&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;SUMX(&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;SUMMARIZE(CC,CC[parts id],CC[part number], cc[country],&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;"volpyref", AVERAGEX(cc,if(CC[param_year]=yr-1, CC[vol]))),&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;[volpyref])&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The similar calculation is working perfectly when I am using it for&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;[Year] = int([ParamYear]) . &lt;/STRONG&gt;I took the variable and passed the same in the Dax, please refer above for more details &lt;/SPAN&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But when its&amp;nbsp;&lt;STRONG&gt;[Year] = int([ParamYear])-1 , &lt;/STRONG&gt;it is giving me blank everytime in power BI but there are values showing for tableau..&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried several methods but i am getting the same everytime. I am trying to calculate this to find previous year vol.&amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;**And year filter is being mandatorily used.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 19 Jun 2022 15:18:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2587379#M74448</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-19T15:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: LOD to DAX conversion</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2589433#M74549</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , try a measure like &lt;/P&gt;
&lt;P&gt;calculate(Average(Table[Vol]), filter(Table, Table[Year] = selectedvalue(Year[Year]), allexcept(Table,Table[Part ID], [Part Number], [Country])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Allexcept with fact table and dimension&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LOD- FIXED (Level of Details): &lt;A href="https://youtu.be/hU-cVOwDCvY" target="_blank"&gt;https://youtu.be/hU-cVOwDCvY&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 11:34:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2589433#M74549</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-06-20T11:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: LOD to DAX conversion</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2589596#M74558</link>
      <description>&lt;P&gt;Hi Amit,&amp;nbsp; thanks for your reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your calculation and many other ways, but the values are not matching.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;yrs&lt;/SPAN&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CC[param_year]&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;yr&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CONVERT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt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t;SPAN&gt;CC[country]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;CC[part_number]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 20 Jun 2022 12:30:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2589596#M74558</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-20T12:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: LOD to DAX conversion</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2603665#M75338</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;Try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR yr =
    SELECTEDVALUE ( CC[Param_year] )
RETURN
    SUMX (
        SUMMARIZE (
            CC,
            CC[parts id],
            CC[part number],
            cc[country],
            "volpyref",
                CALCULATE (
                    AVERAGE ( CC[vol] ),
                    FILTER ( ALL ( CC ), CC[param_year] = yr - 1 )
                )
        ),
        [volpyref]
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this doesn't work, share some sample data for test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reference:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly - Microsoft Power BI Community&lt;/A&gt;&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;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 09:34:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2603665#M75338</guid>
      <dc:creator>Icey</dc:creator>
      <dc:date>2022-06-27T09:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: LOD to DAX conversion</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2619560#M76248</link>
      <description>&lt;P&gt;Hi Icey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies for the late reply as i was busy with some other stuffs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Coming to your provided solution . Atleast this time I am not getting blank, however the value isn't matching to Tableau version.&lt;/P&gt;&lt;P&gt;I will try to provide you sample data after sometime if its possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 10:29:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2619560#M76248</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-05T10:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: LOD to DAX conversion</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2621921#M76402</link>
      <description>&lt;P&gt;Scenario1: I havent selected any year from the year slicer and now PY year is coming for me, also I have hardcoded the previous year as 2021.&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*******&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scenario2:&lt;/P&gt;&lt;P&gt;When I have selected an year from the Base year slicer, PY value will vanish either using hardcode or using a variable also. I have also included your solution, but its coming unique value for all. But i should get the PY year value as show with the hard code value&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;You may also see this coming when i remove country from the table, as i dont need to show it.&amp;nbsp;&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;I will anyway be using country filter for my main dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest me what needs to be done here. I don't think this filter(all(table_name) is required here. but when I am removing this . I am getting blank here as well&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 09:07:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOD-to-DAX-conversion/m-p/2621921#M76402</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-06T09:07:24Z</dc:date>
    </item>
  </channel>
</rss>

