<?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 can we provide the year end string dynamically in TOTALYTD &amp;amp; DATESYTD? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4058328#M161072</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, Try using below measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;C_RAG% YTD =&lt;BR /&gt;VAR v_yearend = SELECTEDVALUE(Formulae[Contract_End])&lt;BR /&gt;VAR Validselection = ISFILTERED('Dim_Sites'[Site &amp;amp; Phase]) &amp;amp;&amp;amp; HASONEVALUE('Dim_Sites'[Site &amp;amp; Phase])&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;Validselection,&lt;BR /&gt;CALCULATE(&lt;BR /&gt;[C_RAG%],&lt;BR /&gt;ALL('Calendar'),&lt;BR /&gt;DATESYTD('Calendar'[Date], v_yearend)&lt;BR /&gt;),&lt;BR /&gt;BLANK() // or you can return some default value or calculation if the selection is not valid&lt;BR /&gt;)&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2024 08:09:39 GMT</pubDate>
    <dc:creator>bhanu_gautam</dc:creator>
    <dc:date>2024-07-24T08:09:39Z</dc:date>
    <item>
      <title>How can we provide the year end string dynamically in TOTALYTD &amp; DATESYTD?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4058195#M161064</link>
      <description>&lt;P&gt;Hi ..,&lt;/P&gt;&lt;P&gt;I am facing the issue of specifying the different yearends in&amp;nbsp;&amp;nbsp;TOTALYTD/DATESYTD functions. I require that according to the Site &amp;amp; Phase selected, the yearend be changed accordingly for the calculations. I have written the following dax which is throwing an error. Can anybody suggest a solution to this?&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;C_RAG% YTD =&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;var v_yearend = SELECTEDVALUE(Formulae[Contract_End])&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;Var Validselection = ISFILTERED('Dim_Sites'[Site &amp;amp; Phase]) &amp;amp;&amp;amp; HASONEVALUE('Dim_Sites'[Site &amp;amp; Phase])&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;RETURN&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;//TOTALYTD( [Actual C_RAG% Static] , ALL('Calendar'[Date]),ALL('Calendar'),v_yearend)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;IF(Validselection,CALCULATE([C_RAG%],ALL('Calendar'), DATESYTD('Calendar'[Date],v_yearend)))&lt;/FONT&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;There are around 20 distinct values for Site &amp;amp; Phase and hence 20 different calendars followed.&amp;nbsp; I do not want to hardcode it.&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Jul 2024 07:22:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4058195#M161064</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-24T07:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can we provide the year end string dynamically in TOTALYTD &amp; DATESYTD?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4058328#M161072</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, Try using below measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;C_RAG% YTD =&lt;BR /&gt;VAR v_yearend = SELECTEDVALUE(Formulae[Contract_End])&lt;BR /&gt;VAR Validselection = ISFILTERED('Dim_Sites'[Site &amp;amp; Phase]) &amp;amp;&amp;amp; HASONEVALUE('Dim_Sites'[Site &amp;amp; Phase])&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;Validselection,&lt;BR /&gt;CALCULATE(&lt;BR /&gt;[C_RAG%],&lt;BR /&gt;ALL('Calendar'),&lt;BR /&gt;DATESYTD('Calendar'[Date], v_yearend)&lt;BR /&gt;),&lt;BR /&gt;BLANK() // or you can return some default value or calculation if the selection is not valid&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 08:09:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4058328#M161072</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-07-24T08:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can we provide the year end string dynamically in TOTALYTD &amp; DATESYTD?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4058741#M161093</link>
      <description>&lt;P&gt;Hi Gautam,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply but this dax is also giving error viz. "Only constant date value is allowed as a year end date argument." That is why I wanted a workaround.&amp;nbsp; Now I will have to write separate calculate function for each site &amp;amp; phase. I wanted to give user the flexibility to change the&amp;nbsp;&lt;SPAN&gt;contract end date and without changing pbix, the change will be implemented.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 10:22:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4058741#M161093</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-24T10:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can we provide the year end string dynamically in TOTALYTD &amp; DATESYTD?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4063411#M161300</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. first of all, create calendar table:&lt;/P&gt;&lt;P&gt;Dax Formula:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Calendar = CALENDAR(MIN(YourData[Date]), MAX(YourData[Date]))&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;2. secondly,&amp;nbsp;Create a measure to get the dynamic year-end date.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DynamicYearEnd = &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;VAR SelectedYearEnd = SELECTEDVALUE(Formulae[Contract_End])&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;RETURN&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;IF(ISBLANK(SelectedYearEnd), DATE(YEAR(TODAY()), 12, 31), SelectedYearEnd)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3.&amp;nbsp;&lt;/STRONG&gt;Use &lt;STRONG&gt;"DATESYTD"&lt;/STRONG&gt; with Dynamic Year-End:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;C_RAG% YTD = &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;VAR v_yearend = [DynamicYearEnd]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;VAR Validselection = ISFILTERED('Dim_Sites'[Site &amp;amp; Phase]) &amp;amp;&amp;amp; HASONEVALUE('Dim_Sites'[Site &amp;amp; Phase])&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;RETURN&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;IF(Validselection, CALCULATE([C_RAG%], DATESYTD('Calendar'[Date], v_yearend)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if this helps you, please approve my solution.&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 08:59:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-we-provide-the-year-end-string-dynamically-in-TOTALYTD/m-p/4063411#M161300</guid>
      <dc:creator>Gaga_Jin</dc:creator>
      <dc:date>2024-07-26T08:59:17Z</dc:date>
    </item>
  </channel>
</rss>

