<?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: sparkline x-axis Last 10Weeks depending on slicer selection in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2968475#M99123</link>
    <description>&lt;P&gt;I tried this code. You're code is working if I am getting the computations. However, I don't want to use any value "FactTable[Value]" and compute it. The measure dax code should only list the top4 quarters (no otehr columns). For example, I selected 2022_04, the list should consist of 2022_04, 2022_03, 2022_01, 2022_00.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This new list in turn will be used in the x-axis of the sparkline. This should show only 4 quarters, instead of all the quarters I have in my historical data.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I tried revising the code to only list the value, however I am getting this error. This is the only thing I changed in your code.&amp;nbsp;&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;img /&gt;&lt;/P&gt;&lt;P&gt;Goal is, shorten this x-axis sparkline to only top4 for quarters. Y-axis will be the "FactTable[Value]" in which measure is already available.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me on this please? Thanks!&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;</description>
    <pubDate>Wed, 14 Dec 2022 15:43:31 GMT</pubDate>
    <dc:creator>kaye123</dc:creator>
    <dc:date>2022-12-14T15:43:31Z</dc:date>
    <item>
      <title>sparkline x-axis Last 10Weeks depending on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2948495#M97634</link>
      <description>&lt;P&gt;I am trying to create a sparkline that will only always show last 10 weeks or last 4 quarters depending on what is my Year selection from a slicer. As per checking in the net, I have to create a flexible dynamic table that will be the place holder of selected weeks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did a formula below but doesn't seem to work as a list of the new column/table. Appreacte any help. Thanks!&lt;BR /&gt;&lt;BR /&gt;Quarter format sample = 2022_1&lt;/P&gt;&lt;P&gt;Week format sample = 2020_01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Top4Q = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Var&lt;/SPAN&gt; &lt;SPAN&gt;MaxQtr&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Maxx&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FiscalCalendar&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;FiscalCalendar&lt;/SPAN&gt;&lt;SPAN&gt;[FiscalQuarter]&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;MinQtr&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MaxQtr&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;4&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Return&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;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FiscalCalendar&lt;/SPAN&gt;&lt;SPAN&gt;[FiscalQuarter]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;FiscalCalendar&lt;/SPAN&gt;&lt;SPAN&gt;[FiscalQuarter]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN&gt;MinQtr&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;FiscalCalendar&lt;/SPAN&gt;&lt;SPAN&gt;[FiscalQuarter]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN&gt;MaxQtr&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Dec 2022 13:17:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2948495#M97634</guid>
      <dc:creator>kaye123</dc:creator>
      <dc:date>2022-12-05T13:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: sparkline x-axis Last 10Weeks depending on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2948812#M97660</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="479321" data-lia-user-login="kaye123" class="lia-mention lia-mention-user"&gt;kaye123&lt;/a&gt; , for 10 week, you have to create&amp;nbsp; separate week/date table with week rank &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new column&lt;/P&gt;
&lt;P&gt;Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense) &lt;BR /&gt;OR&lt;BR /&gt;Week Rank RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measure&lt;/P&gt;
&lt;P&gt;Last 10 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]&amp;gt;=max('Date'[Week Rank])-10&amp;nbsp; &amp;amp;&amp;amp; 'Date'[Week Rank]&amp;lt;=max('Date'[Week Rank])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period, &lt;BR /&gt;Custom Period till date: &lt;A href="https://youtu.be/aU2aKbnHuWs&amp;amp;t=145s" target="_blank"&gt;https://youtu.be/aU2aKbnHuWs&amp;amp;t=145s&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI — Week on Week and WTD &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=pnAesWxYgJ8" target="_blank"&gt;https://www.youtube.com/watch?v=pnAesWxYgJ8&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 15:17:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2948812#M97660</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-12-05T15:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: sparkline x-axis Last 10Weeks depending on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2950218#M97774</link>
      <description>&lt;P&gt;My week date is different. My week 1 is 1st week of november. and is on a character setup "2020_01". How can I use this code with this settings? Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 05:34:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2950218#M97774</guid>
      <dc:creator>kaye123</dc:creator>
      <dc:date>2022-12-06T05:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: sparkline x-axis Last 10Weeks depending on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2958656#M98404</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="479321" data-lia-user-login="kaye123" class="lia-mention lia-mention-user"&gt;kaye123&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You can create a &lt;STRONG&gt;measure&lt;/STRONG&gt; as below to get the values for last 4 quarters:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top4Q =
VAR _selqtr =
    SELECTEDVALUE ( FiscalCalendar[FiscalQuarter] )
VAR _year =
    LEFT ( _selqtr, 4 )
VAR _quarter =
    RIGHT ( _selqtr, 1 )
VAR _preyear = _year - 1
VAR _preqtr = _quarter - 1
VAR _maxqtr =
    IF (
        VALUE ( _quarter ) = 1,
        VALUE ( _preyear &amp;amp; "0" &amp;amp; 4 ),
        VALUE ( _year &amp;amp; "0" &amp;amp; _quarter - 1 )
    )
VAR _minqtr =
    IF (
        VALUE ( _quarter ) = 1,
        VALUE ( _year - 1 &amp;amp; "0" &amp;amp; 1 ),
        VALUE ( _preyear &amp;amp; "0" &amp;amp; _quarter )
    )
RETURN
    CALCULATE (
        SUM ( FactTable[Value] ),
        FILTER (
            FiscalCalendar,
            value(replace(FiscalCalendar[FiscalQuarter],5,1,"0")) &amp;gt;= _minqtr
                &amp;amp;&amp;amp; value(replace(FiscalCalendar[FiscalQuarter],5,1,"0")) &amp;lt;= _maxqtr
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;For the values on last x weeks, you can use the similar logis with the above ones....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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&amp;nbsp;&lt;/STRONG&gt;in your tables&lt;STRONG&gt;&amp;nbsp;(&lt;EM&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;with&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;Text&amp;nbsp;&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;format and your&amp;nbsp;&lt;STRONG&gt;expected result&amp;nbsp;&lt;/STRONG&gt;with backend logic and special examples.&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;simplified&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 09:46:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2958656#M98404</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-09T09:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: sparkline x-axis Last 10Weeks depending on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2968475#M99123</link>
      <description>&lt;P&gt;I tried this code. You're code is working if I am getting the computations. However, I don't want to use any value "FactTable[Value]" and compute it. The measure dax code should only list the top4 quarters (no otehr columns). For example, I selected 2022_04, the list should consist of 2022_04, 2022_03, 2022_01, 2022_00.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This new list in turn will be used in the x-axis of the sparkline. This should show only 4 quarters, instead of all the quarters I have in my historical data.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I tried revising the code to only list the value, however I am getting this error. This is the only thing I changed in your code.&amp;nbsp;&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;img /&gt;&lt;/P&gt;&lt;P&gt;Goal is, shorten this x-axis sparkline to only top4 for quarters. Y-axis will be the "FactTable[Value]" in which measure is already available.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me on this please? Thanks!&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;</description>
      <pubDate>Wed, 14 Dec 2022 15:43:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sparkline-x-axis-Last-10Weeks-depending-on-slicer-selection/m-p/2968475#M99123</guid>
      <dc:creator>kaye123</dc:creator>
      <dc:date>2022-12-14T15:43:31Z</dc:date>
    </item>
  </channel>
</rss>

