<?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: Vendor category based on their monthly average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Vendor-category-based-on-their-monthly-average/m-p/4001262#M155931</link>
    <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="762704" data-lia-user-login="Omaralfalah" class="lia-mention lia-mention-user"&gt;Omaralfalah&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create calculated table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table 2 =
CALENDAR(
    DATE(2024,1,1),
    DATE(2024,12,31))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Create calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;test =
var _mindate=
MINX(FILTER(ALL('Table'),'Table'[vendor name]=EARLIER('Table'[vendor name])),[service invoice approved date])
var _maxdate=
MAXX(FILTER(ALL('Table'),'Table'[vendor name]=EARLIER('Table'[vendor name])),[service actual end date])
var _table1=
FILTER(
    'Table 2','Table 2'[Date]&amp;gt;=_mindate&amp;amp;&amp;amp;'Table 2'[Date]&amp;lt;=_maxdate)
var _table2=
SUMMARIZE(_table1,[Month])
return
CONCATENATEX(
    _table2,[Month],"-"
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;3. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;count of service providers =
var _column=
CONCATENATEX(
    'Table',[test],"/")
return
CALCULATE(
    DISTINCTCOUNT('Table'[vendor name]),
    FILTER(ALL('Table'),
    CONTAINSSTRING(
        'Table'[test],MAX('Table 2'[Month]))=TRUE())
        )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;category =
var _mindate=MINX(FILTER(ALL('Table'),'Table'[vendor name]=MAX('Table'[vendor name])),[service invoice approved date])
var _maxdate=MAXX(FILTER(ALL('Table'),'Table'[vendor name]=MAX('Table'[vendor name])),[service actual end date])
var _count=
CALCULATE(
    DISTINCTCOUNT('Table 2'[Month]),
    FILTER('Table 2',
    'Table 2'[Date]&amp;gt;=_mindate&amp;amp;&amp;amp;'Table 2'[Date]&amp;lt;+_maxdate))
var _sum=
SUMX(
    FILTER(ALL('Table'),'Table'[vendor name]=MAX('Table'[vendor name])),[datediff])
var _divide=
DIVIDE(
_sum, _count)
RETURN
SWITCH(
    TRUE(),
    _divide&amp;gt;=1&amp;amp;&amp;amp;_divide&amp;lt;=20,"1 to 20 days",
    _divide&amp;gt;=21&amp;amp;&amp;amp;_divide&amp;lt;=35,"21 to 35 days",
    "more than 35 days")&lt;/LI-CODE&gt;
&lt;P&gt;4. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jun 2024 06:33:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-20T06:33:05Z</dc:date>
    <item>
      <title>Vendor category based on their monthly average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Vendor-category-based-on-their-monthly-average/m-p/4000317#M155800</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I'm seeking your kind support to assist me in the below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data table that contain :&lt;BR /&gt;- service order numbers ( some of them completed &amp;amp; approved and some not )&lt;BR /&gt;- service order status&lt;BR /&gt;- service provider "vendor name"&lt;BR /&gt;- service actual end date&lt;BR /&gt;- service invoice approved date&lt;BR /&gt;- column shows the time taken for each approved invoice from service actual end date ( service invoice approved date - service actual end date )&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would like to have stacked bar chart that shows the count of service providers " vendor name" in each month based on service invoice approved date and based their monthly average for their approved invoices under which of the following category they fall? ( 1 to 20 days or 21 to 35 days or more than 35 days ) .&lt;BR /&gt;&lt;BR /&gt;please note that I do not want to have same vendor to be repeated in two categories in one month.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 14:20:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Vendor-category-based-on-their-monthly-average/m-p/4000317#M155800</guid>
      <dc:creator>Omaralfalah</dc:creator>
      <dc:date>2024-06-19T14:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Vendor category based on their monthly average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Vendor-category-based-on-their-monthly-average/m-p/4001262#M155931</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="762704" data-lia-user-login="Omaralfalah" class="lia-mention lia-mention-user"&gt;Omaralfalah&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create calculated table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table 2 =
CALENDAR(
    DATE(2024,1,1),
    DATE(2024,12,31))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Create calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;test =
var _mindate=
MINX(FILTER(ALL('Table'),'Table'[vendor name]=EARLIER('Table'[vendor name])),[service invoice approved date])
var _maxdate=
MAXX(FILTER(ALL('Table'),'Table'[vendor name]=EARLIER('Table'[vendor name])),[service actual end date])
var _table1=
FILTER(
    'Table 2','Table 2'[Date]&amp;gt;=_mindate&amp;amp;&amp;amp;'Table 2'[Date]&amp;lt;=_maxdate)
var _table2=
SUMMARIZE(_table1,[Month])
return
CONCATENATEX(
    _table2,[Month],"-"
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;3. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;count of service providers =
var _column=
CONCATENATEX(
    'Table',[test],"/")
return
CALCULATE(
    DISTINCTCOUNT('Table'[vendor name]),
    FILTER(ALL('Table'),
    CONTAINSSTRING(
        'Table'[test],MAX('Table 2'[Month]))=TRUE())
        )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;category =
var _mindate=MINX(FILTER(ALL('Table'),'Table'[vendor name]=MAX('Table'[vendor name])),[service invoice approved date])
var _maxdate=MAXX(FILTER(ALL('Table'),'Table'[vendor name]=MAX('Table'[vendor name])),[service actual end date])
var _count=
CALCULATE(
    DISTINCTCOUNT('Table 2'[Month]),
    FILTER('Table 2',
    'Table 2'[Date]&amp;gt;=_mindate&amp;amp;&amp;amp;'Table 2'[Date]&amp;lt;+_maxdate))
var _sum=
SUMX(
    FILTER(ALL('Table'),'Table'[vendor name]=MAX('Table'[vendor name])),[datediff])
var _divide=
DIVIDE(
_sum, _count)
RETURN
SWITCH(
    TRUE(),
    _divide&amp;gt;=1&amp;amp;&amp;amp;_divide&amp;lt;=20,"1 to 20 days",
    _divide&amp;gt;=21&amp;amp;&amp;amp;_divide&amp;lt;=35,"21 to 35 days",
    "more than 35 days")&lt;/LI-CODE&gt;
&lt;P&gt;4. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 06:33:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Vendor-category-based-on-their-monthly-average/m-p/4001262#M155931</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-20T06:33:05Z</dc:date>
    </item>
  </channel>
</rss>

