<?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 Group tenure months and count the total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-tenure-months-and-count-the-total/m-p/2202804#M51734</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll explain the data first:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set with&lt;/P&gt;&lt;P&gt;- customer number (BPART)&lt;/P&gt;&lt;P&gt;- start date of tenure&lt;/P&gt;&lt;P&gt;- end date of tenure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to report the total count of customer for each month, I have a relationship of many to many through a bridge to a Date dimension&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So for instance, if the customer tenure &lt;STRONG&gt;starts&lt;/STRONG&gt; in "jan2020" and &lt;STRONG&gt;ends&lt;/STRONG&gt; in "December2021", and i am reporting for the month of "March2020", then I can count that customer as active for that month, and so on..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can calculate the tenure in months for each customer using dax, and when I change the &lt;STRONG&gt;DATE,&amp;nbsp;&lt;/STRONG&gt;then the tenure changes acordingly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;tenure_month = DATEDIFF(ENDOFMONTH(BP_TENURE_STAGE_BRIDGE[BP_TENURE_START]),MAX(DIMDATE[DateFullName]),MONTH)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is to group this "tenure month" and count the total customers for each group, using the following grouping&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;lt; 3 months&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;4-6 months&lt;/LI&gt;&lt;LI&gt;7-12 months&lt;/LI&gt;&lt;LI&gt;13-24 months&lt;/LI&gt;&lt;LI&gt;25-60 months&lt;/LI&gt;&lt;LI&gt;+61 months&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This has to be dinamyc, because when I change the reporting period (from the Date Dimension), the tenure for some customer may move from one bucket of tenure into the other one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it would have to look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imagine that this has to be achieved by creating a virtual table that summarises the values, but I cant figure out how to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Due to sensitive data I cant share the PBI file&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much, and let me know if any extra clarification is needed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Nov 2021 04:36:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-11-23T04:36:06Z</dc:date>
    <item>
      <title>Group tenure months and count the total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-tenure-months-and-count-the-total/m-p/2202804#M51734</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll explain the data first:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set with&lt;/P&gt;&lt;P&gt;- customer number (BPART)&lt;/P&gt;&lt;P&gt;- start date of tenure&lt;/P&gt;&lt;P&gt;- end date of tenure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to report the total count of customer for each month, I have a relationship of many to many through a bridge to a Date dimension&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So for instance, if the customer tenure &lt;STRONG&gt;starts&lt;/STRONG&gt; in "jan2020" and &lt;STRONG&gt;ends&lt;/STRONG&gt; in "December2021", and i am reporting for the month of "March2020", then I can count that customer as active for that month, and so on..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can calculate the tenure in months for each customer using dax, and when I change the &lt;STRONG&gt;DATE,&amp;nbsp;&lt;/STRONG&gt;then the tenure changes acordingly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;tenure_month = DATEDIFF(ENDOFMONTH(BP_TENURE_STAGE_BRIDGE[BP_TENURE_START]),MAX(DIMDATE[DateFullName]),MONTH)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is to group this "tenure month" and count the total customers for each group, using the following grouping&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;lt; 3 months&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;4-6 months&lt;/LI&gt;&lt;LI&gt;7-12 months&lt;/LI&gt;&lt;LI&gt;13-24 months&lt;/LI&gt;&lt;LI&gt;25-60 months&lt;/LI&gt;&lt;LI&gt;+61 months&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This has to be dinamyc, because when I change the reporting period (from the Date Dimension), the tenure for some customer may move from one bucket of tenure into the other one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it would have to look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imagine that this has to be achieved by creating a virtual table that summarises the values, but I cant figure out how to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Due to sensitive data I cant share the PBI file&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much, and let me know if any extra clarification is needed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 04:36:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-tenure-months-and-count-the-total/m-p/2202804#M51734</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-23T04:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Group tenure months and count the total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-tenure-months-and-count-the-total/m-p/2202901#M51738</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , I have used these formula in HR with a Date table with some changes they should work in this case &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Method 1&lt;/P&gt;
&lt;P&gt;Employees = COUNT(Emp[Employee Id ])&lt;BR /&gt;Hire = CALCULATE([Employees], USERELATIONSHIP('Date'[Date], Emp[Start Date]))&lt;BR /&gt;Teminated = CALCULATE([Employees], USERELATIONSHIP('Date'[Date], Emp[End Date]), not (ISBLANK(Emp[End Date])))&lt;/P&gt;
&lt;P&gt;Total Emp = CALCULATE( Countx(FILTER(Emp, Emp[Start Date] &amp;lt;= Max('Date'[Date]) &amp;amp;&amp;amp; (ISBLANK(Emp[End Date]) || Emp[End Date] &amp;gt;Max('Date'[Date]))),[Employees]) , CROSSFILTER('Date'[Date],Emp[Start Date],None))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Method 2&lt;/P&gt;
&lt;P&gt;Cumm Hire = CALCULATE([Hire], FILTER(ALL('Date') , 'Date'[Date] &amp;lt;= max('Date'[Date])))&lt;BR /&gt;Cumm Termination = CALCULATE([Teminated], FILTER(ALL('Date'), 'Date'[Date] &amp;lt;= Max('Date'[Date]))) &lt;BR /&gt;Current Employee = [Cumm Hire] -[Cumm Termination]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date table is joined with a start date as active and end date with inactive join&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 05:54:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-tenure-months-and-count-the-total/m-p/2202901#M51738</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-11-23T05:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Group tenure months and count the total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-tenure-months-and-count-the-total/m-p/2204361#M51827</link>
      <description>&lt;P&gt;Hi Mate, this looks great, but unfortunately it doesnt answer my main pain point whihc is creating virtually these bucket of tenure. I need to be able to group them and count the total by group, and that total has to change along with the customer moving onto diff buckets when I change the date&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 20:15:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-tenure-months-and-count-the-total/m-p/2204361#M51827</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-23T20:15:55Z</dc:date>
    </item>
  </channel>
</rss>

