<?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: Granularity with dynamic range limitation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Granularity-with-dynamic-range-limitation/m-p/4266067#M169076</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="749867" data-lia-user-login="gumis_rulez" class="lia-mention lia-mention-user"&gt;gumis_rulez&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One approach is to use a field parameter for the D/W/M/Q/Y slicer. Use the field parameter in the x-axis to enable dynamic selection of granularity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters" target="_self"&gt;https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2024 20:24:10 GMT</pubDate>
    <dc:creator>DataInsights</dc:creator>
    <dc:date>2024-10-31T20:24:10Z</dc:date>
    <item>
      <title>Granularity with dynamic range limitation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Granularity-with-dynamic-range-limitation/m-p/4265658#M169056</link>
      <description>&lt;P&gt;On the left side I have slicer for granularity - made with additional table connected with relationship in both directions.&lt;/P&gt;&lt;P&gt;On the right side I have slicer which limits the range of data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to combine those two solutions so that they would work?&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;P&gt;&lt;A href="https://drive.google.com/file/d/1XwIhdvOdNRbNfQNx9ws-EzrTXT_OkNy2/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1XwIhdvOdNRbNfQNx9ws-EzrTXT_OkNy2/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 13:48:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Granularity-with-dynamic-range-limitation/m-p/4265658#M169056</guid>
      <dc:creator>gumis_rulez</dc:creator>
      <dc:date>2024-10-31T13:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Granularity with dynamic range limitation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Granularity-with-dynamic-range-limitation/m-p/4266067#M169076</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="749867" data-lia-user-login="gumis_rulez" class="lia-mention lia-mention-user"&gt;gumis_rulez&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One approach is to use a field parameter for the D/W/M/Q/Y slicer. Use the field parameter in the x-axis to enable dynamic selection of granularity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters" target="_self"&gt;https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 20:24:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Granularity-with-dynamic-range-limitation/m-p/4266067#M169076</guid>
      <dc:creator>DataInsights</dc:creator>
      <dc:date>2024-10-31T20:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Granularity with dynamic range limitation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Granularity-with-dynamic-range-limitation/m-p/4270743#M169362</link>
      <description>&lt;P&gt;The granularity works: D/W/M/Q/Y is a slicer based on the table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;hlp_Dynamic Date Selections = 
UNION(
    ADDCOLUMNS(
        CALENDAR(
            MIN(dimCalendar[Date]),
            MAX(dimCalendar[Date])
        ),
        "Visual Date", [Date],
        "Type", "D",
        "Order", 1
    ),
    ADDCOLUMNS(
        CALENDAR(
            MIN(dimCalendar[Date]),
            MAX(dimCalendar[Date])
        ),
        "Visual Date", 
        [Date] - WEEKDAY([Date], 2) + 1,
        "Type", "W",
        "Order", 2
    ),
    ADDCOLUMNS(
        CALENDAR(
            MIN(dimCalendar[Date]),
            MAX(dimCalendar[Date])
        ),
        "Visual Date", YEAR([Date]) &amp;amp; "-" &amp;amp; MONTH([Date]),
        "Type", "M",
        "Order", 3
    ),
    ADDCOLUMNS(
        CALENDAR(
            MIN(dimCalendar[Date]),
            MAX(dimCalendar[Date])
        ),
        "Visual Date", YEAR([Date]) &amp;amp; "-Q" &amp;amp; CEILING(MONTH([Date])/3, 1),
        "Type", "Q",
        "Order", 4
    ),
    ADDCOLUMNS(
        CALENDAR(
            MIN(dimCalendar[Date]),
            MAX(dimCalendar[Date])
        ),
        "Visual Date", YEAR([Date]),
        "Type", "Y",
        "Order", 5
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question is how to combine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Date Param = 
CALCULATE(
    [Sales],
    KEEPFILTERS(
        DATESBETWEEN(
            dimCalendar[Date],
            [Selected Min Date],
            [Max Date]
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Selected Min Date = 
VAR _MaxDate = [Max Date]
VAR _MinDate = [Min Date] - 1

RETURN

SWITCH(
    'hlp_Date Selection'[Selected Date Selection],
    "1W", _MaxDate - 7,
    "1M", EDATE(_MaxDate, -1),
    "3M", EDATE(_MaxDate, -3),
    "TY", DATE(YEAR(_MaxDate), 1, 1),
    "1Y", EDATE(_MaxDate, -12),
    "ALL", _MinDate )&lt;/LI-CODE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max Date = 
CALCULATE(
    MAX(dimCalendar[Date]),
    REMOVEFILTERS(dimCalendar[Date])
)&lt;/LI-CODE&gt;&lt;P&gt;to automatically limit the range. If I choose 3M to limit the displayed data to three months?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 13:03:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Granularity-with-dynamic-range-limitation/m-p/4270743#M169362</guid>
      <dc:creator>gumis_rulez</dc:creator>
      <dc:date>2024-11-05T13:03:08Z</dc:date>
    </item>
  </channel>
</rss>

