<?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: Filter on the right row for each user based on timetravel in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-the-right-row-for-each-user-based-on-timetravel/m-p/4182524#M166136</link>
    <description>&lt;P&gt;Thank you so much for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the customer type measure, I cant use it as a legend on the line chart I am trying to make. What would be the solution for that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am basically looking for a visual like this. If a user is custom in January and turns member in July, I want it to be registered as a customer in January and member in July.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2024 13:05:21 GMT</pubDate>
    <dc:creator>bi_ninja</dc:creator>
    <dc:date>2024-10-01T13:05:21Z</dc:date>
    <item>
      <title>Filter on the right row for each user based on timetravel</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-the-right-row-for-each-user-based-on-timetravel/m-p/4179218#M166061</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a mix of data coming from Google Analytics for web traffic which I want to join in with our own DWH to be able to get the best possible insights. So we have the following tables:&lt;/P&gt;&lt;P&gt;1 - Google Analytics - Traffic - It contains traffic on our website. The key here is user_id which can be joined with our DWH to find out more about this user/customer.&lt;/P&gt;&lt;P&gt;2 - Contact - SQL - It contains all our company customers/members in DWH. The key here is user_id to join with Google Analytics table. The table only contains there last status change.&lt;/P&gt;&lt;P&gt;3 - Contact History - SQL - This table contains historical changes for each customer/member in DWH. A customer can go from being a customer to becoming a member and later on go from being a member back to customer. For each change, there is a new row with a dbt_valid_from and dbt_valid_to date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am looking for:&lt;/P&gt;&lt;P&gt;I want to count the number of distinct user_id in Google Analytics - Traffic for the selected dates in "Date" table and I would like to filter on the "active" row at that time. I want to make a line chart from Jan 2024 to September 2024. In this chart I would like to get the customer_type status for each user for each month. The dbt_valid_from and dbt_valid_to columns are the ones to tell when a row is valid or not. The slicer date must be between dbt_valid_from or dbt_valid_to date to select the correct. For current active status the dbt_valid_to can also be NULL as the rows is not expired yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am also attaching a shot from my model. Thanks for all help in advance.&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 09:42:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-the-right-row-for-each-user-based-on-timetravel/m-p/4179218#M166061</guid>
      <dc:creator>bi_ninja</dc:creator>
      <dc:date>2024-09-28T09:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Filter on the right row for each user based on timetravel</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-the-right-row-for-each-user-based-on-timetravel/m-p/4181993#M166121</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="151369" data-lia-user-login="bi_ninja" class="lia-mention lia-mention-user"&gt;bi_ninja&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on the description, try to create a measure to count the number of distinct user_id.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Active User Count = 
    VAR SelectedDate = SELECTEDVALUE('Date'[Date])
    RETURN
    CALCULATE(
        DISTINCTCOUNT('Google Analytics - Traffic'[user_id]),
        FILTER(
            'Contact History',
            ('Contact History'[dbt_valid_from] &amp;lt;= SelectedDate) &amp;amp;&amp;amp; 
            (
                ISBLANK('Contact History'[dbt_valid_to]) || 
                ('Contact History'[dbt_valid_to] &amp;gt;= SelectedDate)
            )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;Then, create a measure to get the customer_type status for each user.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Customer Type = 
    VAR SelectedDate = SELECTEDVALUE('Date'[Date])
    RETURN
    CALCULATE(
        VALUES('Contact History'[customer_type]),
        FILTER(
            'Contact History',
            ('Contact History'[dbt_valid_from] &amp;lt;= SelectedDate) &amp;amp;&amp;amp; 
            (
                ISBLANK('Contact History'[dbt_valid_to]) || 
                ('Contact History'[dbt_valid_to] &amp;gt;= SelectedDate)
            )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;Besides, drag the date field to the X-axis and drag the measure to the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 07:32:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-the-right-row-for-each-user-based-on-timetravel/m-p/4181993#M166121</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-27T07:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Filter on the right row for each user based on timetravel</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-the-right-row-for-each-user-based-on-timetravel/m-p/4182524#M166136</link>
      <description>&lt;P&gt;Thank you so much for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the customer type measure, I cant use it as a legend on the line chart I am trying to make. What would be the solution for that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am basically looking for a visual like this. If a user is custom in January and turns member in July, I want it to be registered as a customer in January and member in July.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 13:05:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-the-right-row-for-each-user-based-on-timetravel/m-p/4182524#M166136</guid>
      <dc:creator>bi_ninja</dc:creator>
      <dc:date>2024-10-01T13:05:21Z</dc:date>
    </item>
  </channel>
</rss>

