<?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: Offset function combined with field parameter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3460621#M132002</link>
    <description>&lt;P&gt;This happens when you sort one column by another column (frequently done in Calendar tables).&amp;nbsp; The sort column needs to be part of the calculation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Might need to use a SWITCH statement to handle the different scenarios.&amp;nbsp; It kinda defeats the purpose of the Field Parameters, but that's something you can recover from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue. &lt;BR /&gt;If you are unsure how to do that please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;If you want to get answers faster please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2023 00:13:08 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2023-10-05T00:13:08Z</dc:date>
    <item>
      <title>Offset function combined with field parameter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3457721#M131814</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a table that will show a change between 2 dates but requirement from the user is to be able to dynamically change time perspective view - so they would like to compare year to year / month to month / week to week / quarter to quarter / day over day. Since there is also week over week needed I cannot use built in time intelligence function. Till now I used additional table with dynamic date selection, however I thought that maybe it will be possible to write a metric with offset function and in the table itselt I could use field parameter. I created it but received info:&amp;nbsp;&lt;SPAN&gt;Column [] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.&lt;BR /&gt;My metric is written as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Change = 
VAR Offset = 
CALCULATE(
    [Total],
    OFFSET(
        -1,
        ALLSELECTED('Dynamic Date Selection'[Dynamic Date Selection]),
        ORDERBY('Dynamic Date Selection'[Dynamic Date Selection], ASC)
        )
    )
VAR PoPChange = 
([Total] - 
CALCULATE(
    [Total],
    OFFSET(
        -1,
        ALLSELECTED('Dynamic Date Selection'[Dynamic Date Selection]),
        ORDERBY('Dynamic Date Selection'[Dynamic Date Selection], ASC)
        )
    )) / CALCULATE(
    [Total],
    OFFSET(
        -1,
        ALLSELECTED('Dynamic Date Selection'[Dynamic Date Selection]),
        ORDERBY('Dynamic Date Selection'[Dynamic Date Selection], ASC)
        )
    )
    VAR Result = IF(NOT ISBLANK(Offset), PoPChange)
    Return
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Dynamic date selection is a table created by using field parameter function:&lt;BR /&gt;|&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dynamic Date Selection = {
    ("calendar_date", NAMEOF('calendar'[calendar_date]), 0),
    ("week_end_date", NAMEOF('calendar'[week_end_date]), 1),
    ("month_end_date", NAMEOF('calendar'[month_end_date]), 2),
    ("year_no", NAMEOF('calendar'[year_no]), 3)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is it even possible to make changes in Change metric to be able to use it in table with field parameter in rows?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 12:52:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3457721#M131814</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-03T12:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Offset function combined with field parameter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3460621#M132002</link>
      <description>&lt;P&gt;This happens when you sort one column by another column (frequently done in Calendar tables).&amp;nbsp; The sort column needs to be part of the calculation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Might need to use a SWITCH statement to handle the different scenarios.&amp;nbsp; It kinda defeats the purpose of the Field Parameters, but that's something you can recover from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue. &lt;BR /&gt;If you are unsure how to do that please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;If you want to get answers faster please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 00:13:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3460621#M132002</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-05T00:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Offset function combined with field parameter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3461204#M132023</link>
      <description>&lt;P&gt;Here you can find powerbi file and excel with sample data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/scl/fo/naasx1kq80ucpxw9o93oc/h?rlkey=mswsz1c7lgmwh1p98qh3t5fku&amp;amp;dl=0" target="_blank"&gt;https://www.dropbox.com/scl/fo/naasx1kq80ucpxw9o93oc/h?rlkey=mswsz1c7lgmwh1p98qh3t5fku&amp;amp;dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I have achieved what was wanted by creating additional dax table and using bookmarks.&lt;/P&gt;&lt;P&gt;However I just wanted to refactor this as I noticed that Field parameter option which I thought is more simple and more elegant.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 07:39:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3461204#M132023</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-05T07:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Offset function combined with field parameter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3464290#M132179</link>
      <description>&lt;P&gt;Your Calendar table has gaps&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;You also didn't specify the four digit years so Power BI got confused.&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;I'd recommend you fix that table first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 16:25:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Offset-function-combined-with-field-parameter/m-p/3464290#M132179</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-06T16:25:35Z</dc:date>
    </item>
  </channel>
</rss>

