<?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: How to use PREVIOUSQUARTER in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452076#M66035</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236559" data-lia-user-login="VoltesDev" class="lia-mention lia-mention-user"&gt;VoltesDev&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may upload to WeTransfer for example and share the link&lt;/P&gt;</description>
    <pubDate>Tue, 12 Apr 2022 10:07:55 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-04-12T10:07:55Z</dc:date>
    <item>
      <title>How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2451147#M65973</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I have this kind of data :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I want to have a measure to current quarter (CQ) and Previous Quarter (PQ), what DAX I actually have to use ?&lt;/P&gt;&lt;P&gt;I have a Date table that relates to that column "Actual Closed Date" and also I have Page Filter context of this Date date table to be relative 1 year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I I tried to count without any date filter in my DAX (Page filter still effected), like this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Win Count = CALCULATE(
		DISTINCTCOUNT(Opportunities[opportunityid]),
		Opportunities,Opportunities[statecodename] = "Won"
		)&lt;/LI-CODE&gt;&lt;P&gt;I have figures like the picture.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created this measure for CQ :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Win Count CQ = CALCULATE(
                    DISTINCTCOUNT(Opportunities[opportunityid]),
                        Opportunities, Opportunities[statecodename] = "Won",
                        DATESQTD('Date Table'[Date])
                        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I'm using PreviousQuarter like this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Win Count PQ = CALCULATE(
                    DISTINCTCOUNT(Opportunities[opportunityid]),
                        Opportunities, Opportunities[statecodename] = "Won",
                        PREVIOUSQUARTER('Date Table'[Date])
                        )&lt;/LI-CODE&gt;&lt;P&gt;But it doesn't give me the correct result, as supposedly based on the picture, I expected to have value of 2 (01/14/22 and 03/14/22).&lt;/P&gt;&lt;P&gt;Can I ask for suggestion which DAX actually more appropriate for this purposes ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 05:34:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2451147#M65973</guid>
      <dc:creator>VoltesDev</dc:creator>
      <dc:date>2022-04-12T05:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2451170#M65975</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236559" data-lia-user-login="VoltesDev" class="lia-mention lia-mention-user"&gt;VoltesDev&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your visual you have to use the date column from date table not the actual close date from the data table&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 05:45:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2451170#M65975</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-12T05:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2451193#M65977</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I changed it to use from Date table instead, but it doesn't look good either -&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Those are hierarchy from auto-date-hierarchy, but it refer to the correct date, but somehow the value is wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, If I included the Win Count measure, it will give me all the Date tables rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 06:02:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2451193#M65977</guid>
      <dc:creator>VoltesDev</dc:creator>
      <dc:date>2022-04-12T06:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2451283#M65979</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236559" data-lia-user-login="VoltesDev" class="lia-mention lia-mention-user"&gt;VoltesDev&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Can you please share a sample file?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 06:35:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2451283#M65979</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-12T06:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452029#M66031</link>
      <description>&lt;P&gt;Hi, I want to, but how to share file (pbix) here ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 09:53:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452029#M66031</guid>
      <dc:creator>VoltesDev</dc:creator>
      <dc:date>2022-04-12T09:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452076#M66035</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236559" data-lia-user-login="VoltesDev" class="lia-mention lia-mention-user"&gt;VoltesDev&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may upload to WeTransfer for example and share the link&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 10:07:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452076#M66035</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-12T10:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452082#M66036</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just setup Box, hopefully can do the same -&amp;gt;&amp;nbsp;&lt;A href="https://app.box.com/s/jvrp20g3hytyabusgewvxynbfkgysidd" target="_blank" rel="noopener"&gt;https://app.box.com/s/jvrp20g3hytyabusgewvxynbfkgysidd&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So basically what I expected is (with the blue background chart), the guy CQ (current quarter) is 0 and PQ (previous quarter) is 2&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 10:14:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452082#M66036</guid>
      <dc:creator>VoltesDev</dc:creator>
      <dc:date>2022-04-12T10:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452160#M66041</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236559" data-lia-user-login="VoltesDev" class="lia-mention lia-mention-user"&gt;VoltesDev&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Uou don't have data for the previuos quarter! Do you mean same quarter perviuos year?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 10:49:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452160#M66041</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-12T10:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452187#M66044</link>
      <description>&lt;P&gt;No, I mean Previous Quarter for this quarter. Actually now I have doubt, does QTD means like today is 12 April, so QTD is 1 Apr - 12 Apr ? So in that sense, what I want for Previous Quarter is the sum of 1 Jan - 30 Mar.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 10:59:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452187#M66044</guid>
      <dc:creator>VoltesDev</dc:creator>
      <dc:date>2022-04-12T10:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PREVIOUSQUARTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452328#M66051</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236559" data-lia-user-login="VoltesDev" class="lia-mention lia-mention-user"&gt;VoltesDev&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please refer to the sample file with the solution&amp;nbsp;&lt;A href="https://www.dropbox.com/t/RftKbPYvOBYLJO4A" target="_blank"&gt;https://www.dropbox.com/t/RftKbPYvOBYLJO4A&lt;/A&gt;&lt;BR /&gt;I have updated the Date table ti suit this type of calculation.&amp;nbsp;&lt;BR /&gt;As long as Win/Lost is kept on the slicer there is no need to hard code it. You can simply switch between Lost and Win from the slicer. If you still need it the same way before I guess no issue for you to do that.&lt;BR /&gt;The count measure&amp;nbsp;is simple distinct count. If a quarter is selected it will simply calculate the count for the selected quarter.&amp;nbsp;&lt;BR /&gt;The Quarter to Year measure calculates the cumulative&amp;nbsp;count staring from the start of the quarter up to the selected date. It will give the same result as the simple count except when you look at day or week level.&lt;BR /&gt;The previous quarter&amp;nbsp;calculates the count of the selected date but shifted one quarter back in the time.&lt;BR /&gt;Same for the previous&amp;nbsp;quarter to dater&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Count = DISTINCTCOUNT ( Opportunities[opportunityid] )&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Count PQ = 
VAR CurrentYearQuarterNumber = SELECTEDVALUE ( 'Date'[Year Quarter Number] )
VAR PreviousYearQuarterNumber = CurrentYearQuarterNumber - 1
VAR Result =
    CALCULATE (
        DISTINCTCOUNT ( Opportunities[opportunityid] ),
        REMOVEFILTERS ( 'Date' ),
        'Date'[Year Quarter Number] = PreviousYearQuarterNumber,
        VALUES ( 'Date'[Month In Quarter Number] )
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Count QTD = 
VAR LastMonthAvailable =
    MAX ( 'Date'[Year Month Number] )
VAR LastYearQuarterAvailable =
    MAX ( 'Date'[Year Quarter Number] )
VAR Result =
    CALCULATE ( 
        DISTINCTCOUNT ( Opportunities[opportunityid] ), 
        REMOVEFILTERS ( 'Date' ),
        'Date'[Year Month Number] &amp;lt;= LastMonthAvailable,
        'Date'[Year Quarter Number] = LastYearQuarterAvailable
    ) 
RETURN 
    Result&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Count PQTD = 
VAR CurrentYearQuarterNumber = SELECTEDVALUE ( 'Date'[Year Quarter Number] )
VAR PreviousYearQuarterNumber = CurrentYearQuarterNumber - 1
VAR Result =
    CALCULATE (
        [Count QTD],
        REMOVEFILTERS ( 'Date' ),
        'Date'[Year Quarter Number] = PreviousYearQuarterNumber,
        VALUES ( 'Date'[Month In Quarter Number] )
    )
RETURN
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 Apr 2022 11:46:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-PREVIOUSQUARTER/m-p/2452328#M66051</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-12T11:46:59Z</dc:date>
    </item>
  </channel>
</rss>

