<?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: Use selected date slicer value to calculate ages in a column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4140371#M164524</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="803126" data-lia-user-login="ses6791" class="lia-mention lia-mention-user"&gt;ses6791&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, it is possible to calculate the age based on the starting date of the selected period. the solution is to write a measure insted of column as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure_Age :=&amp;nbsp;(&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Customers&lt;/SPAN&gt;&lt;SPAN&gt;[DOB]&lt;/SPAN&gt;&lt;SPAN&gt;)- MIN(DimDate[Datekey])) / 365&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post helps, then I would appreciate a thumbs up&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&amp;nbsp;&amp;nbsp;and mark it as the solution&amp;nbsp;to help the other members find it more quickly.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2024 09:30:54 GMT</pubDate>
    <dc:creator>Selva-Salimi</dc:creator>
    <dc:date>2024-09-09T09:30:54Z</dc:date>
    <item>
      <title>Use selected date slicer value to calculate ages in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4139304#M164432</link>
      <description>&lt;P&gt;Hi, I hope someone can help. I have seen other similar posts but i don't think they're answering my query. I am trying to use a date value selected by the user in a slicer to calculate the ages of the individual records in my source table. So my column formula would be like "(Selected slicer date - record Date of Birth)/365". The slicer dates represent the beginning of a period (i.e. 1st Jan 2022, 1st Jan 2023, 1st Jan 2024 etc) and i want to calculate how old the individual records were at these points in time. Eventually, i will have a further dropdown slicer where the user can select an age group (where age is calculated at the selected period beginning) to show in a visual. Is this possible? Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2024 13:23:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4139304#M164432</guid>
      <dc:creator>ses6791</dc:creator>
      <dc:date>2024-09-08T13:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use selected date slicer value to calculate ages in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4139310#M164433</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Given a Customer table with a field DOB and a Date Table in which you use the DateKey as a page filter.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;To understand what's going on I recommend creating a separate measure for&amp;nbsp; SELECTEDVALUE(DimDate[Datekey]) and then dropping that into a card visual so you can see how this changes as you select the date filter. Here is the DAX for a measure 'Age' that will do the work for you.&lt;BR /&gt;&lt;BR /&gt;Age =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; VAR&lt;/SPAN&gt; &lt;SPAN&gt;DOB&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Customers&lt;/SPAN&gt;&lt;SPAN&gt;[DOB]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;Selected_Date&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DimDate&lt;/SPAN&gt;&lt;SPAN&gt;[Datekey]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;Age&lt;/SPAN&gt;&lt;SPAN&gt; = &amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;[DOB]&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;[Selected Date]&lt;/SPAN&gt;&lt;SPAN&gt;)/&lt;/SPAN&gt;&lt;SPAN&gt;365&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;Age&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 08 Sep 2024 14:12:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4139310#M164433</guid>
      <dc:creator>FlipFlop1</dc:creator>
      <dc:date>2024-09-08T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Use selected date slicer value to calculate ages in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4139391#M164446</link>
      <description>&lt;P&gt;Hi, thanks very much for your response. I think i've got it all working up to the point where the Age column doesn't seem to change when i choose different dates. I'll send you some screenshots of what i've set up. Any ideas gratefully received. Thanks&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2024 19:55:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4139391#M164446</guid>
      <dc:creator>ses6791</dc:creator>
      <dc:date>2024-09-08T19:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Use selected date slicer value to calculate ages in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4140371#M164524</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="803126" data-lia-user-login="ses6791" class="lia-mention lia-mention-user"&gt;ses6791&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, it is possible to calculate the age based on the starting date of the selected period. the solution is to write a measure insted of column as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure_Age :=&amp;nbsp;(&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Customers&lt;/SPAN&gt;&lt;SPAN&gt;[DOB]&lt;/SPAN&gt;&lt;SPAN&gt;)- MIN(DimDate[Datekey])) / 365&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post helps, then I would appreciate a thumbs up&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&amp;nbsp;&amp;nbsp;and mark it as the solution&amp;nbsp;to help the other members find it more quickly.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 09:30:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4140371#M164524</guid>
      <dc:creator>Selva-Salimi</dc:creator>
      <dc:date>2024-09-09T09:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Use selected date slicer value to calculate ages in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4141704#M164602</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="803126" data-lia-user-login="ses6791" class="lia-mention lia-mention-user"&gt;ses6791&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I created these data.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. enter a new table here with the start of a period written in it to be used as a slicer field.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&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;2. create measure, which calculates the age.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
(SELECTEDVALUE('Table 2'[beginning of a period]) - MAX('Table'[DOB])) / 365
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. enter a table again with age groups written in it to use as a slicer.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;4. Create a measure to calculate which age group the current client belongs to.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 2 = 
SWITCH(TRUE(),
'Table'[Measure] &amp;lt; 18, "under 18",
'Table'[Measure] &amp;gt;= 18 &amp;amp;&amp;amp; 'Table'[Measure] &amp;lt;60, "18-59",
'Table'[Measure] &amp;gt;= 60,"60+")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 3 = 
IF([Measure 2] = SELECTEDVALUE('Table 3'[age group]),1)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5. Drag and drop measure 3 into the filter window of the table visual object to filter the data with value 1.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The final result is shown below, more detailed information can refer to the attachment.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 02:20:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4141704#M164602</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-10T02:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Use selected date slicer value to calculate ages in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4143650#M164689</link>
      <description>&lt;P&gt;Hi, that was a really great reply, thanks. I think my post heading was a bit misleading as what i want to be able to do is create a visual a bit like (1) below. So rather than a visual that lists all the clients and their DOBs and age at beginning of the period, i would like to be able to count the clients that are in the chosen age group. So in my basic example (1) below, i have chosen Gender as a column and i then put in a count column so that it gives a count of the number of Males and Females. I want to be able to do the same with the choose the "beginning of period" and the "age group" that you created, but when i do it with Measure 3 in the filter window, it doesn't show any values or Total at all (see (2)). I have saved what i've done in the pbix but i don't seem to be able to attach it. Very grateful if you could tell me where i'm going wrong. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(1)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;(2)&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;</description>
      <pubDate>Tue, 10 Sep 2024 22:23:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4143650#M164689</guid>
      <dc:creator>ses6791</dc:creator>
      <dc:date>2024-09-10T22:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Use selected date slicer value to calculate ages in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4161675#M165344</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="803126" data-lia-user-login="ses6791" class="lia-mention lia-mention-user"&gt;ses6791&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create another measure on top of the previous one.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 4 = 
COUNTX(FILTER('Table','Table'[Measure 3] = 1),'Table'[Measure])&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 07:51:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-selected-date-slicer-value-to-calculate-ages-in-a-column/m-p/4161675#M165344</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-20T07:51:42Z</dc:date>
    </item>
  </channel>
</rss>

