<?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: Get a Prior Period Value based off of A Slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2378108#M61352</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="160280" data-lia-user-login="jslade" class="lia-mention lia-mention-user"&gt;jslade&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I apologise as I am not entirely understanding why you want to use lookeupvalue function, but to fix the error, you can replace the calculate with calculatetable(). The result is a table and also the values(). Then use the calcualtetable() as the filters of calculate(). Something like the following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;a =
VAR YrsBack =
    SELECTEDVALUE ( Years[Years] )
RETURN
    CALCULATE (
        SUM ( Query1[value] ),
        CALCULATETABLE (
            VALUES ( Query1[date] ),
            FILTER (
                ALL ( Query1 ),
                Query1[Date]
                    = DATEADD (
                        Query1[Date],
                        ( -364 * YrsBack )
                            + -7
                                * ROUND ( YrsBack / 5.5, 0 ),
                        DAY
                    )
            )
        )
    )
&lt;/LI-CODE&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;Community Support Team _ chenwu zhu&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>Mon, 07 Mar 2022 08:37:08 GMT</pubDate>
    <dc:creator>v-chenwuz-msft</dc:creator>
    <dc:date>2022-03-07T08:37:08Z</dc:date>
    <item>
      <title>Get a Prior Period Value based off of A Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2371308#M60857</link>
      <description>&lt;P&gt;I'm struggling to get my DAX to work.&amp;nbsp; I'm trying to use a measure to return a value from a prior year based off of the slicer the user picks.&amp;nbsp; The slicer is the number of years back they want to look at (so current year - 1 or -2, etc).&amp;nbsp; When I tried the LOOKUPValue function I got "A table of mltiple values was supplied where a single value was expected error", when I added the measure to the table with multiple dates in it.&amp;nbsp; Then I tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;VAR YrsBack = SELECTEDVALUE(Years[Years])&lt;BR /&gt;RETURN CALCULATE(VALUES(Query1[value]),&lt;BR /&gt;FILTER( ALL (Query1),&lt;BR /&gt;Query1[Date] = DATEADD(Query1[Date], (-364 * YrsBack) + -7 * ROUND(YrsBack / 5.5, 0), day))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which doesn't error, but I'm not getting any results in the table.&amp;nbsp; I know I can get it to work by creating a column for each prior year, but was hoping I could do it thru a measue so that I don't have to keep adding a new column every year.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 00:13:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2371308#M60857</guid>
      <dc:creator>jslade</dc:creator>
      <dc:date>2022-03-03T00:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get a Prior Period Value based off of A Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2371390#M60861</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="160280" data-lia-user-login="jslade" class="lia-mention lia-mention-user"&gt;jslade&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can you post sample data as text and expected output?&lt;BR /&gt;Not enough information to go on;&lt;BR /&gt;&lt;BR /&gt;please see this post regarding How to Get Your Question Answered Quickly:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;The most important parts are:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;1. Sample data as text, use the table tool in the editing bar&lt;BR /&gt;2. Expected output from sample data&lt;BR /&gt;3. Explanation in words of how to get from 1. to 2.&lt;BR /&gt;4. Relation between your tables&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;LinkedIn:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 01:05:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2371390#M60861</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2022-03-03T01:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Get a Prior Period Value based off of A Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2373091#M60989</link>
      <description>&lt;P&gt;Thank you &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315278" data-lia-user-login="VahidDM" class="lia-mention lia-mention-user"&gt;VahidDM&lt;/a&gt; Below is the data I'm playing with and an image of my test PBIX.&amp;nbsp; I'm trying to get a value for the same day last year or 2 or 3 years for the dates in my table.&amp;nbsp; I can't use the&amp;nbsp;sameperiodlastyear function because they want it to be the same day of the week comparision (so Saturday to Saturday and Sunday to Sunday)&amp;nbsp; They also want to be able to compare any year to another year, so I was hoping to use some slicers for them to pick the year they want as the base/ current year and then the number of years back that they want to compare it to.&amp;nbsp; As I mentioned when I tried the LookupValue function I kept getting the multiple values error, but when I try to do a calculate with a filter I don't get any results back (I'm guessing because it is returning for a prior year and my year slicer is filtering on the current year).&amp;nbsp; I'm expecting for the first row in my table (Saturday, January 15, 22) to return Saturday, January 16, 2021 when they pick 1 for the Years Back Slicer and Saturday, January 18, 2020 when they pick 2 for the Years Back Slicer.&amp;nbsp; I am able to get it to work if I do it as sperate columns in my table, but am hoping to do it as a messure so I don't have to add a column at the beging of each year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 16:02:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2373091#M60989</guid>
      <dc:creator>jslade</dc:creator>
      <dc:date>2022-03-03T16:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get a Prior Period Value based off of A Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2378108#M61352</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="160280" data-lia-user-login="jslade" class="lia-mention lia-mention-user"&gt;jslade&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I apologise as I am not entirely understanding why you want to use lookeupvalue function, but to fix the error, you can replace the calculate with calculatetable(). The result is a table and also the values(). Then use the calcualtetable() as the filters of calculate(). Something like the following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;a =
VAR YrsBack =
    SELECTEDVALUE ( Years[Years] )
RETURN
    CALCULATE (
        SUM ( Query1[value] ),
        CALCULATETABLE (
            VALUES ( Query1[date] ),
            FILTER (
                ALL ( Query1 ),
                Query1[Date]
                    = DATEADD (
                        Query1[Date],
                        ( -364 * YrsBack )
                            + -7
                                * ROUND ( YrsBack / 5.5, 0 ),
                        DAY
                    )
            )
        )
    )
&lt;/LI-CODE&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;Community Support Team _ chenwu zhu&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>Mon, 07 Mar 2022 08:37:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2378108#M61352</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-03-07T08:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get a Prior Period Value based off of A Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2379133#M61415</link>
      <description>&lt;P&gt;Thank you for the repsonse.&amp;nbsp; That solution did fix my error, but unfortantly, I just got blank results back.&amp;nbsp; I ended up just using the LookupValue function as a new column in my table, so I have a column for each value (prior year value, prior 2 year value, etc).&amp;nbsp; That seems to be working; it's not ideal, but at least I'm able to get the results they are looking for.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 15:57:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-Prior-Period-Value-based-off-of-A-Slicer/m-p/2379133#M61415</guid>
      <dc:creator>jslade</dc:creator>
      <dc:date>2022-03-07T15:57:48Z</dc:date>
    </item>
  </channel>
</rss>

