<?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 difference between dynamic date range in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3659568#M141807</link>
    <description>&lt;P&gt;Thank you for the resolution, i have worked through it and as far as my powerbi DAX knowledge goes, nothing seems to be incorrect however i am get a BLANK value on the scorecard and the second measure produces no results in a table or matrix.&lt;BR /&gt;&lt;BR /&gt;I have broken down each part of the measure you wrote and understand each bit indiviudally and it all makes perfect sense. Not only that PowerBi hasn't highlighted any issues. I tried doing it without the Date slicer and instead just used the date of the report directly but this gave me the same result. Next i removed any other slicers to see if that was impacting the data but again i got the same BLANK card.&lt;BR /&gt;&lt;BR /&gt;Could something else in the report be interfering with the outcome other than another slicer?&lt;/P&gt;&lt;P&gt;Again, having broken down the measure in to its constituent parts it should, work but for no obvious reason, it isn't. Any other steer or guidance whould be hugely appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Memphis&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2024 09:46:29 GMT</pubDate>
    <dc:creator>Memphis28</dc:creator>
    <dc:date>2024-01-25T09:46:29Z</dc:date>
    <item>
      <title>Percentage difference between dynamic date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3657076#M141681</link>
      <description>&lt;P&gt;Afternoon&lt;BR /&gt;&lt;BR /&gt;I have had a look on the forum and, depsite the wealth of knoweldge i can't seem to find the answer to my issue so hoping someone can point me in the right direction.&lt;/P&gt;&lt;P&gt;I think it is a simple ask but i am relatively new and can't seem to get my head around it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a measure that will calculate the percentage difference between two values (this will be a total count value of cases/tickets). I want to be be able to change the date range using a slicer and have the percentage dynamically change wiht it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So case count on the MIN date is first value and the case count on the MAX date is the second value. I tried using the quick measures tool but it forces your hand in to choosing a specific date as you can see below. Is there a way to adapt to function code to make it dynamic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The outcome being two things, a scorecard that shows the percentage difference between the date range (as selcetd by a slicer) and a table with the date of each report and the difference between the MIN date and the date of the report (see bottom screen shot)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am keen to learn so any guidance on how to do it but also why it is done that way is hugely appreciated.&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;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count of CASE_ID % difference from &lt;/SPAN&gt;&lt;SPAN&gt;27&lt;/SPAN&gt;&lt;SPAN&gt; October &lt;/SPAN&gt;&lt;SPAN&gt;2023&lt;/SPAN&gt;&lt;SPAN&gt; =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;__BASELINE_VALUE&lt;/SPAN&gt;&lt;SPAN&gt; =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbs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lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&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;NOT&lt;/SPAN&gt; &lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;__MEASURE_VALUE&lt;/SPAN&gt;&lt;SPAN&gt;),&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;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;__MEASURE_VALUE&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;__BASELINE_VALUE&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;__BASELINE_VALUE&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;BR /&gt;Below is showing the differnece from the 27th of Oct no matter the date selected using the slicer.&lt;BR /&gt;FYI the slicer uses the date of the report data&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Jan 2024 12:48:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3657076#M141681</guid>
      <dc:creator>Memphis28</dc:creator>
      <dc:date>2024-01-24T12:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage difference between dynamic date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3658511#M141754</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453803" data-lia-user-login="Memphis28" class="lia-mention lia-mention-user"&gt;Memphis28&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1) This is my test data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(2)&amp;nbsp;We can create a&amp;nbsp;&lt;SPAN&gt;Date Slicer table and a measure.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date Slicer = CALENDAR(FIRSTDATE('TeamJ'[date]),LASTDATE('TeamJ'[date]))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
var _slicer_min_date=MIN('Date Slicer'[Date])
var _slicer_max_date=MAX('Date Slicer'[Date])
var _min_value=CALCULATE(COUNTA('TeamJ'[case_id]),FILTER(ALLSELECTED('TeamJ'),'TeamJ'[date]=_slicer_min_date))
var _max_value=CALCULATE(COUNTA('TeamJ'[case_id]),FILTER(ALLSELECTED('TeamJ'),'TeamJ'[date]=_slicer_max_date))
RETURN DIVIDE(_min_value,_max_value,0)&lt;/LI-CODE&gt;
&lt;P&gt;The range of the slicer at this point is 2023-2-1 through 2024-1-15, at which point the measure will count the number of cases on the minimum date (2023-2-1) / the number of cases on the maximum date (2024-1-15).&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you change the slicer range, then the measure will also change automatically.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(3) Then we can create another measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 2 = 
var _slicer_min_date=MIN('Date Slicer'[Date])
var _min_value=CALCULATE(COUNTA('TeamJ'[case_id]),FILTER(ALLSELECTED('TeamJ'),'TeamJ'[date]=_slicer_min_date))
var _report_value=COUNTA('TeamJ'[case_id])
RETURN DIVIDE(_min_value,_report_value,0)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;For learning about measure values and dax, you can refer to the:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-measures" target="_blank"&gt;Measures in Power BI Desktop - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-quickstart-learn-dax-basics" target="_blank"&gt;Learn DAX basics in Power BI Desktop - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 02:32:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3658511#M141754</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-25T02:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage difference between dynamic date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3659568#M141807</link>
      <description>&lt;P&gt;Thank you for the resolution, i have worked through it and as far as my powerbi DAX knowledge goes, nothing seems to be incorrect however i am get a BLANK value on the scorecard and the second measure produces no results in a table or matrix.&lt;BR /&gt;&lt;BR /&gt;I have broken down each part of the measure you wrote and understand each bit indiviudally and it all makes perfect sense. Not only that PowerBi hasn't highlighted any issues. I tried doing it without the Date slicer and instead just used the date of the report directly but this gave me the same result. Next i removed any other slicers to see if that was impacting the data but again i got the same BLANK card.&lt;BR /&gt;&lt;BR /&gt;Could something else in the report be interfering with the outcome other than another slicer?&lt;/P&gt;&lt;P&gt;Again, having broken down the measure in to its constituent parts it should, work but for no obvious reason, it isn't. Any other steer or guidance whould be hugely appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Memphis&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 09:46:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3659568#M141807</guid>
      <dc:creator>Memphis28</dc:creator>
      <dc:date>2024-01-25T09:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage difference between dynamic date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3662308#M141918</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453803" data-lia-user-login="Memphis28" class="lia-mention lia-mention-user"&gt;Memphis28&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you check the model relationship? Please make sure that there is no relationship between the slicer table and the data table.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/STRONG&gt;) with&amp;nbsp;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;pbix file.&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 08:46:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3662308#M141918</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-26T08:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage difference between dynamic date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3666120#M142115</link>
      <description>&lt;P&gt;Afternoon&lt;BR /&gt;I haven't had chances to try this suggestion yet, i will do as soon as i can and report back.&lt;BR /&gt;I did figure a quick and dirty way of getting some of what i needed but it isn't the final solution. I created two measures, one that found the Value on the FIRSTDATE in the Date table and one that found the LASTDATE in the date table and then wrote a 3rd measure to DIVIDE the two. Not elegent or efficient but it worked on the day.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PercentSlicerDiffMin =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNTA&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TeamJ&lt;/SPAN&gt;&lt;SPAN&gt;[CASE_ID]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;FIRSTDATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TeamJ&lt;/SPAN&gt;&lt;SPAN&gt;[Date of Report]&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PercentSlicerDiffMin =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNTA&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TeamJ&lt;/SPAN&gt;&lt;SPAN&gt;[CASE_ID]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;LASTDATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TeamJ&lt;/SPAN&gt;&lt;SPAN&gt;[Date of Report]&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PercentDivide =&lt;/SPAN&gt; &lt;SPAN&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[PercentSlicerDiffMin]&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;[PercentSlicerDiffMax]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;[PercentSlicerDiffMax]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&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 still need a better solution that wll show the changes in a table so i will try and pull some sample data and a streamlined version of PBIX later today and share with you.&lt;BR /&gt;Again, the help is appreciated. Thank you &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 29 Jan 2024 12:15:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-difference-between-dynamic-date-range/m-p/3666120#M142115</guid>
      <dc:creator>Memphis28</dc:creator>
      <dc:date>2024-01-29T12:15:45Z</dc:date>
    </item>
  </channel>
</rss>

