<?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 DAX Calculated Column is not working correctly in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/DAX-Calculated-Column-is-not-working-correctly/m-p/3250081#M42794</link>
    <description>&lt;P&gt;I have the following table with over 10K records in my SSAS Tabular model&lt;/P&gt;&lt;P&gt;Client Episodes Monthly Rollup:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EpisodesSample.PNG" style="width: 495px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/919075i3B3BF9752D803F21/image-size/large?v=v2&amp;amp;px=999" role="button" title="EpisodesSample.PNG" alt="EpisodesSample.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need to create a Calculated Column in DAX - [DaysGroups].&lt;/P&gt;&lt;P&gt;This Column should assign days intervals - "&lt;FONT color="#993300"&gt;0-90&lt;/FONT&gt;" Days, "&lt;FONT color="#993300"&gt;91-180&lt;/FONT&gt;" Days, "&lt;FONT color="#993300"&gt;181-270&lt;/FONT&gt;" Days," &lt;FONT color="#993300"&gt;270+&lt;/FONT&gt;" Days, based on the highest [&lt;STRONG&gt;LengthOfStayToDate&lt;/STRONG&gt;] value, for each [&lt;STRONG&gt;ClientWHID&lt;/STRONG&gt;], where [&lt;STRONG&gt;DischargeDate&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;2050-12-31&lt;/FONT&gt; and [&lt;STRONG&gt;EpisodeStatus&lt;/STRONG&gt;] = "&lt;FONT color="#993300"&gt;ACTIVE&lt;/FONT&gt;".&lt;/P&gt;&lt;P&gt;In the example above - there are 2 ClientWHIDs - &lt;FONT color="#993300"&gt;30636&lt;/FONT&gt;, &lt;FONT color="#993300"&gt;37623.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If [&lt;STRONG&gt;ClientWHID&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;30636&lt;/FONT&gt;,&lt;/P&gt;&lt;P&gt;[&lt;STRONG&gt;DischargeDate&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;2050-12-31&lt;/FONT&gt; and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;STRONG&gt;EpisodeStatus&lt;/STRONG&gt;&lt;SPAN&gt;] = "&lt;/SPAN&gt;&lt;FONT color="#993300"&gt;ACTIVE&lt;/FONT&gt;&lt;SPAN&gt;",&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;then - the highest [&lt;STRONG&gt;LengthOfStayToDate&lt;/STRONG&gt;] value for this Client is &lt;FONT color="#993300"&gt;335&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;This means, my Calculated Column [&lt;STRONG&gt;DaysGroups]&lt;/STRONG&gt; should assign "&lt;FONT color="#993300"&gt;270+&lt;/FONT&gt;" Days interval for all records where [&lt;STRONG&gt;ClientWHID]&lt;/STRONG&gt; = &lt;FONT color="#993300"&gt;30636&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If [&lt;STRONG&gt;ClientWHID&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;37623&lt;/FONT&gt;,&lt;/P&gt;&lt;P&gt;[&lt;STRONG&gt;DischargeDate&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;2050-12-31&lt;/FONT&gt; and&lt;/P&gt;&lt;P&gt;[&lt;STRONG&gt;EpisodeStatus&lt;/STRONG&gt;] = "&lt;FONT color="#993300"&gt;ACTIVE&lt;/FONT&gt;",&lt;/P&gt;&lt;P&gt;then the highest the highest [&lt;STRONG&gt;LengthOfStayToDate&lt;/STRONG&gt;] value for this Client is &lt;FONT color="#993300"&gt;2&lt;/FONT&gt; (only one value in this example).&lt;/P&gt;&lt;P&gt;This means, my Calculated Column [&lt;STRONG&gt;DaysGroups&lt;/STRONG&gt;] should have all records "&lt;FONT color="#993300"&gt;0-90&lt;/FONT&gt;" Days for [&lt;STRONG&gt;ClientWHID&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;37623&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following DAX code, but it assigns my ALL ClientWHIDs with "&lt;STRONG&gt;270+&lt;/STRONG&gt;" Days interval&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR ActiveRecords =
  CALCULATETABLE (
        'Client Episodes Monthly Rollup',
          FILTER (
            'Client Episodes Monthly Rollup',
            'Client Episodes Monthly Rollup'[EpisodeStatus] = "ACTIVE"
        &amp;amp;&amp;amp; 'Client Episodes Monthly Rollup'[DischargeDate] = DATE ( 2050, 12, 31 )
                
             )
            )

VAR MaxLOSByClient =
    SUMMARIZE (
        ActiveRecords,
        'Client Episodes Monthly Rollup'[ClientWHID],
        "MaxLOS",
            MAXX (
                'Client Episodes Monthly Rollup',
                'Client Episodes Monthly Rollup'[LengthOfStayToDate]
                 )
              )

VAR MaxLOS =
    MAXX ( MaxLOSByClient, [MaxLOS] )
RETURN
    SWITCH (
        TRUE (),
        MaxLOS &amp;gt;= 0
            &amp;amp;&amp;amp; MaxLOS &amp;lt;= 90, "0-90",
        MaxLOS &amp;gt;= 91
            &amp;amp;&amp;amp; MaxLOS &amp;lt;= 180, "91-180",
        MaxLOS &amp;gt;= 181
            &amp;amp;&amp;amp; MaxLOS &amp;lt;= 270, "181-270",
        MaxLOS &amp;gt; 270, "270+",
        BLANK ()
           )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It results with ALL my ClientWHIDs = &lt;FONT color="#993300"&gt;270+&lt;/FONT&gt; Days interval&lt;/P&gt;&lt;P&gt;See below, from my model -&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EpisodesResultSample.PNG" style="width: 586px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/919078iE40A769458D0BA49/image-size/large?v=v2&amp;amp;px=999" role="button" title="EpisodesResultSample.PNG" alt="EpisodesResultSample.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please - HELP!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 May 2023 03:02:29 GMT</pubDate>
    <dc:creator>Hell-1931</dc:creator>
    <dc:date>2023-05-24T03:02:29Z</dc:date>
    <item>
      <title>DAX Calculated Column is not working correctly</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/DAX-Calculated-Column-is-not-working-correctly/m-p/3250081#M42794</link>
      <description>&lt;P&gt;I have the following table with over 10K records in my SSAS Tabular model&lt;/P&gt;&lt;P&gt;Client Episodes Monthly Rollup:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EpisodesSample.PNG" style="width: 495px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/919075i3B3BF9752D803F21/image-size/large?v=v2&amp;amp;px=999" role="button" title="EpisodesSample.PNG" alt="EpisodesSample.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need to create a Calculated Column in DAX - [DaysGroups].&lt;/P&gt;&lt;P&gt;This Column should assign days intervals - "&lt;FONT color="#993300"&gt;0-90&lt;/FONT&gt;" Days, "&lt;FONT color="#993300"&gt;91-180&lt;/FONT&gt;" Days, "&lt;FONT color="#993300"&gt;181-270&lt;/FONT&gt;" Days," &lt;FONT color="#993300"&gt;270+&lt;/FONT&gt;" Days, based on the highest [&lt;STRONG&gt;LengthOfStayToDate&lt;/STRONG&gt;] value, for each [&lt;STRONG&gt;ClientWHID&lt;/STRONG&gt;], where [&lt;STRONG&gt;DischargeDate&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;2050-12-31&lt;/FONT&gt; and [&lt;STRONG&gt;EpisodeStatus&lt;/STRONG&gt;] = "&lt;FONT color="#993300"&gt;ACTIVE&lt;/FONT&gt;".&lt;/P&gt;&lt;P&gt;In the example above - there are 2 ClientWHIDs - &lt;FONT color="#993300"&gt;30636&lt;/FONT&gt;, &lt;FONT color="#993300"&gt;37623.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If [&lt;STRONG&gt;ClientWHID&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;30636&lt;/FONT&gt;,&lt;/P&gt;&lt;P&gt;[&lt;STRONG&gt;DischargeDate&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;2050-12-31&lt;/FONT&gt; and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;STRONG&gt;EpisodeStatus&lt;/STRONG&gt;&lt;SPAN&gt;] = "&lt;/SPAN&gt;&lt;FONT color="#993300"&gt;ACTIVE&lt;/FONT&gt;&lt;SPAN&gt;",&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;then - the highest [&lt;STRONG&gt;LengthOfStayToDate&lt;/STRONG&gt;] value for this Client is &lt;FONT color="#993300"&gt;335&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;This means, my Calculated Column [&lt;STRONG&gt;DaysGroups]&lt;/STRONG&gt; should assign "&lt;FONT color="#993300"&gt;270+&lt;/FONT&gt;" Days interval for all records where [&lt;STRONG&gt;ClientWHID]&lt;/STRONG&gt; = &lt;FONT color="#993300"&gt;30636&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If [&lt;STRONG&gt;ClientWHID&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;37623&lt;/FONT&gt;,&lt;/P&gt;&lt;P&gt;[&lt;STRONG&gt;DischargeDate&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;2050-12-31&lt;/FONT&gt; and&lt;/P&gt;&lt;P&gt;[&lt;STRONG&gt;EpisodeStatus&lt;/STRONG&gt;] = "&lt;FONT color="#993300"&gt;ACTIVE&lt;/FONT&gt;",&lt;/P&gt;&lt;P&gt;then the highest the highest [&lt;STRONG&gt;LengthOfStayToDate&lt;/STRONG&gt;] value for this Client is &lt;FONT color="#993300"&gt;2&lt;/FONT&gt; (only one value in this example).&lt;/P&gt;&lt;P&gt;This means, my Calculated Column [&lt;STRONG&gt;DaysGroups&lt;/STRONG&gt;] should have all records "&lt;FONT color="#993300"&gt;0-90&lt;/FONT&gt;" Days for [&lt;STRONG&gt;ClientWHID&lt;/STRONG&gt;] = &lt;FONT color="#993300"&gt;37623&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following DAX code, but it assigns my ALL ClientWHIDs with "&lt;STRONG&gt;270+&lt;/STRONG&gt;" Days interval&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR ActiveRecords =
  CALCULATETABLE (
        'Client Episodes Monthly Rollup',
          FILTER (
            'Client Episodes Monthly Rollup',
            'Client Episodes Monthly Rollup'[EpisodeStatus] = "ACTIVE"
        &amp;amp;&amp;amp; 'Client Episodes Monthly Rollup'[DischargeDate] = DATE ( 2050, 12, 31 )
                
             )
            )

VAR MaxLOSByClient =
    SUMMARIZE (
        ActiveRecords,
        'Client Episodes Monthly Rollup'[ClientWHID],
        "MaxLOS",
            MAXX (
                'Client Episodes Monthly Rollup',
                'Client Episodes Monthly Rollup'[LengthOfStayToDate]
                 )
              )

VAR MaxLOS =
    MAXX ( MaxLOSByClient, [MaxLOS] )
RETURN
    SWITCH (
        TRUE (),
        MaxLOS &amp;gt;= 0
            &amp;amp;&amp;amp; MaxLOS &amp;lt;= 90, "0-90",
        MaxLOS &amp;gt;= 91
            &amp;amp;&amp;amp; MaxLOS &amp;lt;= 180, "91-180",
        MaxLOS &amp;gt;= 181
            &amp;amp;&amp;amp; MaxLOS &amp;lt;= 270, "181-270",
        MaxLOS &amp;gt; 270, "270+",
        BLANK ()
           )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It results with ALL my ClientWHIDs = &lt;FONT color="#993300"&gt;270+&lt;/FONT&gt; Days interval&lt;/P&gt;&lt;P&gt;See below, from my model -&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EpisodesResultSample.PNG" style="width: 586px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/919078iE40A769458D0BA49/image-size/large?v=v2&amp;amp;px=999" role="button" title="EpisodesResultSample.PNG" alt="EpisodesResultSample.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please - HELP!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 03:02:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/DAX-Calculated-Column-is-not-working-correctly/m-p/3250081#M42794</guid>
      <dc:creator>Hell-1931</dc:creator>
      <dc:date>2023-05-24T03:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Calculated Column is not working correctly</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/DAX-Calculated-Column-is-not-working-correctly/m-p/3252102#M42813</link>
      <description>&lt;LI-CODE lang="markup"&gt;I need to create a Calculated Column in DAX - [DaysGroups].&lt;/LI-CODE&gt;
&lt;P&gt;Are you sure you want to do that from a connection to a SSAS tabular source?&amp;nbsp; Is your data model&amp;nbsp; in mixed mode?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually this would have to be a measure, or implemented in the source.&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 01:41:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/DAX-Calculated-Column-is-not-working-correctly/m-p/3252102#M42813</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-25T01:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Calculated Column is not working correctly</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/DAX-Calculated-Column-is-not-working-correctly/m-p/3253054#M42827</link>
      <description>&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/100342" target="_self"&gt;&lt;SPAN class=""&gt;lbendlin&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The answers for the 1st 2 questions are "Yes"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this can be a measure - that's ok!&amp;nbsp; Anything that will work the way I described&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 10:28:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/DAX-Calculated-Column-is-not-working-correctly/m-p/3253054#M42827</guid>
      <dc:creator>Hell-1931</dc:creator>
      <dc:date>2023-05-25T10:28:31Z</dc:date>
    </item>
  </channel>
</rss>

