<?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: Dax query help for calculated table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-query-help-for-calculated-table/m-p/4332983#M172022</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="283494" data-lia-user-login="PriyaJha" class="lia-mention lia-mention-user"&gt;PriyaJha&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To create a calculated table in Power BI that identifies names missing in the current month compared to the previous month, you first need to create a calculated calendar table to use in your data model, as your Month column only show text value and Power BI will not be able to recognize it as short month name.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, you will need to add a calculated column in your table like below in order to create a many-to-one relationship with your calculated calendar table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FullDate = 
DATE(2023, 
    SWITCH(
        'Table'[Month],
        "Jan", 1,
        "Feb", 2,
        "Mar", 3,
        "Apr", 4,
        "May", 5,
        "Jun", 6,
        "Jul", 7,
        "Aug", 8,
        "Sep", 9,
        "Oct", 10,
        "Nov", 11,
        "Dec", 12,
        BLANK()
    ), 
1)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next you can create a calculated table which produces your required output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MissingNames = 
VAR AllNames = DISTINCT('Table'[Name])
VAR AllDates = DISTINCT('Table'[FullDate])
VAR AllCombinations =
    CROSSJOIN(
        SELECTCOLUMNS(
            AllDates,
            "Month", FORMAT([FullDate], "MMM"),
            "FullDate", [FullDate]
        ),
        AllNames
    )
RETURN
FILTER(
    AllCombinations,
    VAR CurrentMonth = [FullDate]
    VAR PrevMonthNumeric = MONTH(CurrentMonth) - 1
    VAR PrevYear = YEAR(CurrentMonth) - IF(PrevMonthNumeric = 0, 1, 0)
    VAR PrevMonthAdjusted = IF(PrevMonthNumeric = 0, 12, PrevMonthNumeric)
    VAR Previous_Month = DATE(PrevYear, PrevMonthAdjusted, 1)
    VAR NamesInCurrentMonth =
        CALCULATETABLE(
            VALUES('Table'[Name]),
            'Table'[FullDate] &amp;gt;= CurrentMonth,
            'Table'[FullDate] &amp;lt; EOMONTH(CurrentMonth, 0) + 1
        )
    VAR NamesInPreviousMonth =
        CALCULATETABLE(
            VALUES('Table'[Name]),
            'Table'[FullDate] &amp;gt;= Previous_Month,
            'Table'[FullDate] &amp;lt; CurrentMonth
        )
    RETURN
        NOT([Name] IN NamesInCurrentMonth) &amp;amp;&amp;amp;
        [Name] IN NamesInPreviousMonth
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This DAX formula calculates a table of missing names that appeared in the previous month but not in the current month. It starts by retrieving distinct names and distinct full dates. It crossjoins these two lists to produce all combinations of months and names. For each combination, it determines the current month’s date, calculates the first day of the previous month, and then uses CALCULATETABLE to find which names appeared in the current month and which names appeared in the previous month. Finally, it applies a filter that returns only those names that were present previously but are missing now.&lt;/SPAN&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;I have attached an example pbix file for your reference.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2024 12:45:05 GMT</pubDate>
    <dc:creator>DataNinja777</dc:creator>
    <dc:date>2024-12-17T12:45:05Z</dc:date>
    <item>
      <title>Dax query help for calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-query-help-for-calculated-table/m-p/4332924#M172019</link>
      <description>&lt;P&gt;In Power BI, I have a table,&lt;BR /&gt;&lt;BR /&gt;Month | Name&lt;BR /&gt;Sep | R1&lt;BR /&gt;Sep | R2&lt;BR /&gt;Sep | R3&lt;BR /&gt;Oct | R1&lt;BR /&gt;Oct | R4&lt;BR /&gt;Nov | R1&lt;BR /&gt;Nov | R5&lt;BR /&gt;&lt;BR /&gt;I need to create a calculated table to show the names, who is missing for in the current month as compared to previous month&lt;BR /&gt;&lt;BR /&gt;E.g.&lt;BR /&gt;Month | Name&lt;BR /&gt;Oct | R2&lt;BR /&gt;Oct | R3&lt;BR /&gt;Nov |R4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to proceed with this?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 11:13:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-query-help-for-calculated-table/m-p/4332924#M172019</guid>
      <dc:creator>PriyaJha</dc:creator>
      <dc:date>2024-12-17T11:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dax query help for calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-query-help-for-calculated-table/m-p/4332983#M172022</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="283494" data-lia-user-login="PriyaJha" class="lia-mention lia-mention-user"&gt;PriyaJha&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To create a calculated table in Power BI that identifies names missing in the current month compared to the previous month, you first need to create a calculated calendar table to use in your data model, as your Month column only show text value and Power BI will not be able to recognize it as short month name.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, you will need to add a calculated column in your table like below in order to create a many-to-one relationship with your calculated calendar table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FullDate = 
DATE(2023, 
    SWITCH(
        'Table'[Month],
        "Jan", 1,
        "Feb", 2,
        "Mar", 3,
        "Apr", 4,
        "May", 5,
        "Jun", 6,
        "Jul", 7,
        "Aug", 8,
        "Sep", 9,
        "Oct", 10,
        "Nov", 11,
        "Dec", 12,
        BLANK()
    ), 
1)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next you can create a calculated table which produces your required output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MissingNames = 
VAR AllNames = DISTINCT('Table'[Name])
VAR AllDates = DISTINCT('Table'[FullDate])
VAR AllCombinations =
    CROSSJOIN(
        SELECTCOLUMNS(
            AllDates,
            "Month", FORMAT([FullDate], "MMM"),
            "FullDate", [FullDate]
        ),
        AllNames
    )
RETURN
FILTER(
    AllCombinations,
    VAR CurrentMonth = [FullDate]
    VAR PrevMonthNumeric = MONTH(CurrentMonth) - 1
    VAR PrevYear = YEAR(CurrentMonth) - IF(PrevMonthNumeric = 0, 1, 0)
    VAR PrevMonthAdjusted = IF(PrevMonthNumeric = 0, 12, PrevMonthNumeric)
    VAR Previous_Month = DATE(PrevYear, PrevMonthAdjusted, 1)
    VAR NamesInCurrentMonth =
        CALCULATETABLE(
            VALUES('Table'[Name]),
            'Table'[FullDate] &amp;gt;= CurrentMonth,
            'Table'[FullDate] &amp;lt; EOMONTH(CurrentMonth, 0) + 1
        )
    VAR NamesInPreviousMonth =
        CALCULATETABLE(
            VALUES('Table'[Name]),
            'Table'[FullDate] &amp;gt;= Previous_Month,
            'Table'[FullDate] &amp;lt; CurrentMonth
        )
    RETURN
        NOT([Name] IN NamesInCurrentMonth) &amp;amp;&amp;amp;
        [Name] IN NamesInPreviousMonth
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This DAX formula calculates a table of missing names that appeared in the previous month but not in the current month. It starts by retrieving distinct names and distinct full dates. It crossjoins these two lists to produce all combinations of months and names. For each combination, it determines the current month’s date, calculates the first day of the previous month, and then uses CALCULATETABLE to find which names appeared in the current month and which names appeared in the previous month. Finally, it applies a filter that returns only those names that were present previously but are missing now.&lt;/SPAN&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;I have attached an example pbix file for your reference.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 12:45:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-query-help-for-calculated-table/m-p/4332983#M172022</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-12-17T12:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dax query help for calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-query-help-for-calculated-table/m-p/4333004#M172026</link>
      <description>&lt;P&gt;Make sure that you have a date table, marked as a date table, linked to your main fact table. Then you can use&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Missing names =
GENERATE (
    VALUES ( 'Date'[Year month] ),
    VAR CurrentNames =
        VALUES ( 'Table'[Name] )
    VAR PrevNames =
        CALCULATETABLE ( VALUES ( 'Table'[Name] ), DATEADD ( 'Date'[Date], -1, MONTH ) )
    VAR Result =
        EXCEPT ( PrevNames, CurrentNames )
    RETURN
        Result
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 Dec 2024 12:04:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-query-help-for-calculated-table/m-p/4333004#M172026</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-12-17T12:04:21Z</dc:date>
    </item>
  </channel>
</rss>

