<?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 to Display Measure-Based Buckets in Stacked Bar Chart Legend in Power BI? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4698425#M179970</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN data-teams="true"&gt;I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please &lt;STRONG&gt;Accept it as a solution&lt;/STRONG&gt; and give it a '&lt;STRONG&gt;Kudos&lt;/STRONG&gt;' so others can find it easily.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 May 2025 12:08:25 GMT</pubDate>
    <dc:creator>v-karpurapud</dc:creator>
    <dc:date>2025-05-19T12:08:25Z</dc:date>
    <item>
      <title>How to Display Measure-Based Buckets in Stacked Bar Chart Legend in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4684612#M179419</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm working on a Power BI report where I have:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A &lt;STRONG&gt;date slicer&lt;/STRONG&gt; (from a calendar table)&lt;/LI&gt;&lt;LI&gt;A table of activities with an ACTIVITY_DATE&lt;/LI&gt;&lt;LI&gt;A measure that calculates the &lt;STRONG&gt;age in days&lt;/STRONG&gt; by comparing each ACTIVITY_DATE with the selected slicer date&lt;/LI&gt;&lt;LI&gt;Based on that, I created a &lt;STRONG&gt;bucket measure&lt;/STRONG&gt; to group records into:&lt;UL&gt;&lt;LI&gt;"0-2 weeks" (0–14 days)&lt;/LI&gt;&lt;LI&gt;"3-4 weeks" (15–28 days)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Now, I have a &lt;STRONG&gt;stacked bar chart&lt;/STRONG&gt; where the &lt;STRONG&gt;X-axis is an organization category&lt;/STRONG&gt; (e.g., Org1, Org2, etc.). I want to show, &lt;STRONG&gt;for each organization&lt;/STRONG&gt;, how many records fall into the &lt;STRONG&gt;"0-2 weeks" and "3-4 weeks"&lt;/STRONG&gt; buckets.&lt;/P&gt;&lt;P&gt;The problem is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Since the bucket is calculated using a &lt;STRONG&gt;measure&lt;/STRONG&gt; (due to dependence on slicer), I &lt;STRONG&gt;can’t add it to the Legend&lt;/STRONG&gt; field.&lt;/LI&gt;&lt;LI&gt;I can't use a calculated column either, because it won’t react to the date slicer.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Is there a recommended method or workaround&lt;/STRONG&gt; to make these measure-based buckets appear in the legend or to achieve this kind of breakdown in a stacked bar chart?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 11:23:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4684612#M179419</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-05-08T11:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Display Measure-Based Buckets in Stacked Bar Chart Legend in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4684754#M179427</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Hi!&amp;nbsp;you can achieve this breakdown using a disconnected table as a legend proxy and a SWITCH-based measure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Create a disconnected table:&lt;/P&gt;
&lt;P&gt;AgeBuckets = DATATABLE(&lt;BR /&gt;"Bucket", STRING,&lt;BR /&gt;{&lt;BR /&gt;{"0-2 weeks"},&lt;BR /&gt;{"3-4 weeks"}&lt;BR /&gt;}&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Create a measure:&lt;/P&gt;
&lt;P&gt;ActivityCountByBucket = &lt;BR /&gt;VAR SelectedBucket = SELECTEDVALUE(AgeBuckets[Bucket])&lt;BR /&gt;RETURN&lt;BR /&gt;SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;SelectedBucket = "0-2 weeks",&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(Activities),&lt;BR /&gt;FILTER(&lt;BR /&gt;Activities,&lt;BR /&gt;[Age in Days] &amp;gt;= 0 &amp;amp;&amp;amp; [Age in Days] &amp;lt;= 14&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;SelectedBucket = "3-4 weeks",&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(Activities),&lt;BR /&gt;FILTER(&lt;BR /&gt;Activities,&lt;BR /&gt;[Age in Days] &amp;gt;= 15 &amp;amp;&amp;amp; [Age in Days] &amp;lt;= 28&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Build the visual with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI data-start="1674" data-end="1711"&gt;
&lt;P data-start="1676" data-end="1711"&gt;X-axis: Organization category&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="1712" data-end="1748"&gt;
&lt;P data-start="1714" data-end="1748"&gt;Legend: AgeBuckets[Bucket]&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="1749" data-end="1786"&gt;
&lt;P data-start="1751" data-end="1786"&gt;Values: ActivityCountByBucket&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;BBF&lt;/P&gt;
&lt;DIV style="font-family: Segoe UI, sans-serif; font-size: 14px; line-height: 1.2;"&gt;&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; &lt;STRONG&gt;Did I answer your question?&lt;/STRONG&gt; Mark my post as a solution! &lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; Kudos are appreciated &lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;span class="lia-unicode-emoji" title=":fire:"&gt;🔥&lt;/span&gt; Proud to be a Super User!&lt;/STRONG&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt; &lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 12:03:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4684754#M179427</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2025-05-08T12:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to Display Measure-Based Buckets in Stacked Bar Chart Legend in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4685925#M179475</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="202311" data-lia-user-login="BeaBF" class="lia-mention lia-mention-user"&gt;BeaBF&lt;/a&gt;&amp;nbsp; for you quick response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding your issue with displaying measure-based buckets in a stacked bar chart legend in Power BI, please use a disconnected table for the buckets and a dynamic measure to calculate the counts.&lt;BR /&gt;&lt;BR /&gt;Disconnected Table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Buckets =
DATATABLE(
   "Bucket", STRING,
   "MinDays", INTEGER,
   "MaxDays", INTEGER,
   {
       {"0-2 weeks", 0, 14},
       {"3-4 weeks", 15, 28}
   }
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a Measure to Calculate Activities per Bucket&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Activities per Bucket =
VAR SelectedDate = COALESCE(SELECTEDVALUE('Calendar'[Date]), TODAY())
VAR CurrentBucket = SELECTEDVALUE('Buckets'[Bucket])
RETURN
IF(
   ISBLANK(CurrentBucket),
   0,
   CALCULATE(
       COUNTROWS('Activities'),
       FILTER(
           'Activities',
           NOT ISBLANK('Activities'[ACTIVITY_DATE]) &amp;amp;&amp;amp;
           VAR AgeInDays = DATEDIFF('Activities'[ACTIVITY_DATE], SelectedDate, DAY)
           VAR BucketMin = CALCULATE(MIN('Buckets'[MinDays]), 'Buckets'[Bucket] = CurrentBucket)
           VAR BucketMax = CALCULATE(MAX('Buckets'[MaxDays]), 'Buckets'[Bucket] = CurrentBucket)
           RETURN
           AgeInDays &amp;gt;= BucketMin &amp;amp;&amp;amp; AgeInDays &amp;lt;= BucketMax
       )
   )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add a Stacked Bar Chart visual to your report and drag the Bucket field from the Buckets table. This will split the bars by bucket (e.g., "0-2 weeks", "3-4 weeks").&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the chart doesn’t accept the measure, delete the visual and create a new stacked bar chart, then reconfigure it as described above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are still unable to use the measure, consider using a stacked column chart instead of a stacked bar chart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this response resolves your query, kindly mark it as &lt;STRONG&gt;Accepted Solution &lt;/STRONG&gt;to help other community members. A &lt;STRONG&gt;Kudos&lt;/STRONG&gt; is also appreciated if you found the response helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank You!&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2025 05:31:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4685925#M179475</guid>
      <dc:creator>v-karpurapud</dc:creator>
      <dc:date>2025-05-09T05:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Display Measure-Based Buckets in Stacked Bar Chart Legend in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4688588#M179561</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 May 2025 07:10:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4688588#M179561</guid>
      <dc:creator>v-karpurapud</dc:creator>
      <dc:date>2025-05-12T07:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to Display Measure-Based Buckets in Stacked Bar Chart Legend in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4694256#M179773</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2025 12:29:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4694256#M179773</guid>
      <dc:creator>v-karpurapud</dc:creator>
      <dc:date>2025-05-15T12:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Display Measure-Based Buckets in Stacked Bar Chart Legend in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4698425#M179970</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN data-teams="true"&gt;I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please &lt;STRONG&gt;Accept it as a solution&lt;/STRONG&gt; and give it a '&lt;STRONG&gt;Kudos&lt;/STRONG&gt;' so others can find it easily.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 May 2025 12:08:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Display-Measure-Based-Buckets-in-Stacked-Bar-Chart-Legend/m-p/4698425#M179970</guid>
      <dc:creator>v-karpurapud</dc:creator>
      <dc:date>2025-05-19T12:08:25Z</dc:date>
    </item>
  </channel>
</rss>

