<?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: Percentage of difference between previous quarters in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139358#M164440</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="195725" data-lia-user-login="sanalytics" class="lia-mention lia-mention-user"&gt;sanalytics&lt;/a&gt;&amp;nbsp;thanks for your answer, I actually tried to figure out what was wrong with my previous code and for that I broke it down, in 3 single measures (as you did) and realize that the Current Patients for the selected quarter and the Current Patients from my previous quarter were being well calculated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem comes with the % of Difference between the two measures, please see below picture&amp;nbsp; (KPIs cards for each country) where it displays the current and previous quarter patients and the % Diff, that as you can see based for the values displayed is being miscalculated (I dont know why, I used your formula (measure 3)).&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;Also answering to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;I dont see the benefit of creating a calendar table cause at the end Power BI will take it as text, since there is no format (at least that I am aware of) to treat the Quarters data as a date&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Silvia&lt;/P&gt;</description>
    <pubDate>Sun, 08 Sep 2024 17:29:08 GMT</pubDate>
    <dc:creator>Silvia_GB</dc:creator>
    <dc:date>2024-09-08T17:29:08Z</dc:date>
    <item>
      <title>Percentage of difference between previous quarters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4138992#M164419</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a measure that calculates the percentage of difference between my previous quarters (all in the same year), so basically Q4 vs Q3, Q3 vs Q2 and Q2 vs Q1. I created the following measure but it only gives me 0. I created the different variables separatley and also changing the quarters type of data, cause I have it as text, like Q1 2025, Q2 2025, Q3 2025, and Q4 2025.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am also not sure if I did right is about using the Q Patients measure, which is a measure that takes the current patients from the Product and Quarter selected on the filter in the page&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;LI-CODE lang="markup"&gt;PercentageChange = 
VAR SelectedQuarter = SELECTEDVALUE('Total Patients Quarters'[Quarters])
VAR SelectedProduct = SELECTEDVALUE('FY 2025'[Product])
VAR CurrentQtr = VALUE(MID(SelectedQuarter, 2, 1))
VAR PreviousQtr = IF(CurrentQtr = 1, 4, CurrentQtr - 1)
VAR PQ = "Q" &amp;amp; PreviousQtr

VAR CurrentPatients = [Q Patients]
VAR PreviousPatients = 
    CALCULATE(
        [Q Patients], 
        'FY 2025'[Product] = SelectedProduct, 
        'Total Patients Quarters'[Quarters] = PQ
    )

RETURN
    IF(
        ISBLANK(PreviousPatients), 
        BLANK(), 
        DIVIDE(CurrentPatients - PreviousPatients, PreviousPatients, 0)
    )&lt;/LI-CODE&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;Hope someone can help me out&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Silvia&lt;/P&gt;</description>
      <pubDate>Sat, 07 Sep 2024 18:31:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4138992#M164419</guid>
      <dc:creator>Silvia_GB</dc:creator>
      <dc:date>2024-09-07T18:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of difference between previous quarters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139019#M164420</link>
      <description>&lt;P&gt;Make it a habit to include a calendar table in your data model, and to base all time related calculations on that calendar table.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Sep 2024 20:29:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139019#M164420</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-09-07T20:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of difference between previous quarters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139208#M164429</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="801840" data-lia-user-login="Silvia_GB" class="lia-mention lia-mention-user"&gt;Silvia_GB&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;As&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp; mentioned it is always to have proper schema (Preferebly Star schema with no bidrectional relationship)) or Data model. DAX work best in the schema.&lt;BR /&gt;Now coming to your solution, i have considered two tables DimDate and FactSales.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have created 3 measures in order to achieve your solution. We can reduce the measures number but just created for the sake of your understanding.&lt;/P&gt;&lt;P&gt;Step 1 : Your DateDimension should have Quarter Sort column and Based on that create following measure.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR _Calc = 
CALCULATE(
    [Sales]
    , FILTER( 
        ALL( DimDate[QuarterSort],DimDate[Quarter &amp;amp; Year], DimDate[Year] ),
        DimDate[QuarterSort] = MAX(DimDate[QuarterSort] )-1
        &amp;amp;&amp;amp;
        DimDate[Year] = MAX( DimDate[Year] )
    ) )
VAR _Result = 
IF(
    ISBLANK( _Calc ), 0,
    _Calc
)

RETURN
_Result&lt;/LI-CODE&gt;&lt;P&gt;Step 2 : Create a measure which will show the correct total.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUMX(
    VALUES( DimDate[Quarter &amp;amp; Year] ),
    [PrevQCalculation]
)&lt;/LI-CODE&gt;&lt;P&gt;Step 3 : Then Created final QoQ% Measure.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR _CurrentSales = [Sales]
VAR _PriorQuarter = [Prior Quarter]
VAR _Result = 
DIVIDE( _CurrentSales - _PriorQuarter,_PriorQuarter,0 )
RETURN
_Result&lt;/LI-CODE&gt;&lt;P&gt;Below is the screenshot&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Below is the attached file&lt;/P&gt;&lt;P&gt;&lt;A href="https://we.tl/t-gZ8bxJyFYW" target="_blank"&gt;https://we.tl/t-gZ8bxJyFYW&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope, it helps&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;sanalytics&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;If it is your solution then please like and accept it as solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2024 08:59:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139208#M164429</guid>
      <dc:creator>sanalytics</dc:creator>
      <dc:date>2024-09-08T08:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of difference between previous quarters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139315#M164434</link>
      <description>&lt;P&gt;If you have a date table, you may be able to use the PREVIOUSQUARTER() function&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Prev Qtr Sales = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; SalesPrevQtr = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(FactOnlineSales, FactOnlineSales[SalesAmount]), &lt;/SPAN&gt;&lt;SPAN&gt;PREVIOUSQUARTER&lt;/SPAN&gt;&lt;SPAN&gt;(DimDate[Datekey]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SalesPrevQtr&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 08 Sep 2024 14:30:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139315#M164434</guid>
      <dc:creator>FlipFlop1</dc:creator>
      <dc:date>2024-09-08T14:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of difference between previous quarters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139358#M164440</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="195725" data-lia-user-login="sanalytics" class="lia-mention lia-mention-user"&gt;sanalytics&lt;/a&gt;&amp;nbsp;thanks for your answer, I actually tried to figure out what was wrong with my previous code and for that I broke it down, in 3 single measures (as you did) and realize that the Current Patients for the selected quarter and the Current Patients from my previous quarter were being well calculated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem comes with the % of Difference between the two measures, please see below picture&amp;nbsp; (KPIs cards for each country) where it displays the current and previous quarter patients and the % Diff, that as you can see based for the values displayed is being miscalculated (I dont know why, I used your formula (measure 3)).&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;Also answering to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;I dont see the benefit of creating a calendar table cause at the end Power BI will take it as text, since there is no format (at least that I am aware of) to treat the Quarters data as a date&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Silvia&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2024 17:29:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139358#M164440</guid>
      <dc:creator>Silvia_GB</dc:creator>
      <dc:date>2024-09-08T17:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of difference between previous quarters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139387#M164445</link>
      <description>&lt;P&gt;Add a fake date column to your fact table, for example the first day of the quarter.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2024 19:51:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4139387#M164445</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-09-08T19:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of difference between previous quarters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4169077#M165629</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="801840" data-lia-user-login="Silvia_GB" class="lia-mention lia-mention-user"&gt;Silvia_GB&lt;/a&gt;&amp;nbsp;，&lt;BR /&gt;It's been a while since I heard back from you and I wanted to follow up. Has the problem you were experiencing been resolved? If the issue has been resolved, can you mark the post as resolved? If you're still experiencing challenges, please feel free to let us know and we'll be happy to continue to help!&lt;BR /&gt;Looking forward to your reply!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 02:57:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4169077#M165629</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-24T02:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of difference between previous quarters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4273853#M169552</link>
      <description>&lt;P&gt;Hi, sorry for my late answer. Yes, the problem was solved but I dont know how to mark the the post as resolved, that's why I didnt do it.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2024 10:28:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-of-difference-between-previous-quarters/m-p/4273853#M169552</guid>
      <dc:creator>Silvia_GB</dc:creator>
      <dc:date>2024-11-07T10:28:22Z</dc:date>
    </item>
  </channel>
</rss>

