<?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: STATUS HISTORY RANGE TIME in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4273751#M169545</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="761233" data-lia-user-login="Joaomatos2002" class="lia-mention lia-mention-user"&gt;Joaomatos2002&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please update the formula of measure as below and check if it can return the expected result.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _date =
    SELECTEDVALUE ( 'Date'[date] )
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[CARD_NUMber],
        "@maxdate",
            CALCULATE (
                MAX ( 'Table'[date] ),
                FILTER ( 'Table', 'Table'[CARD_NUMber] = EARLIER ( 'Table'[CARD_NUMber] ) )
            )
    )
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[CARD_NUMber] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[CARD_NUMber] = MAXX ( _tab, [CARD_NUMber] )
                &amp;amp;&amp;amp; 'Table'[date] &amp;lt;= _date
                &amp;amp;&amp;amp; 'Table'[date] &amp;lt;= MAXX ( _tab, [@maxdate] )
        )
    )
RETURN
    COUNTROWS ( _tab )&lt;/LI-CODE&gt;
&lt;P&gt;If the above one can't help you figure out, please&amp;nbsp;&lt;SPAN&gt;provide more&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;raw data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;in your tables&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;) with&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;format&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and your&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-provide-sample-data-in-the-Power-BI-Forum%2Fba-p%2F963216&amp;amp;data=05%7C01%7CClaire.Dong%40microsoft.com%7Cada9149bd91546a8432508dacd31ef9b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638047911607737134%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=EJlYfclgtrjgAEYj9Uo1AauqxaQm3hlQsjJMo4zCY1M%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
    <pubDate>Thu, 07 Nov 2024 09:36:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-07T09:36:51Z</dc:date>
    <item>
      <title>STATUS HISTORY RANGE TIME</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4271112#M169396</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;At the moment, I am working on a report and encountered a challenge. I have a table that shows the status change history for various cards over time. A card can be blocked multiple times and can also be reactivated multiple times after being blocked. My goal is to navigate through this historical table. For example, a card has been active since January, but in March it became blocked. When I select the month of February, this card will be shown as active, but when I select the month of October, it will appear as blocked. This applies to multiple cards because my aim is to calculate both the total and cumulative totals of cards in an active status or any other selected status (depending on the analysis) from the beginning of the data up to the selected month. This is possible thanks to the saved history. The purpose of this is to understand the status of cards over time when selecting different dates.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I will send a sample table of the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt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TD&gt;ACTIVO&lt;/TD&gt;&lt;TD&gt;BLOQ_DM&lt;/TD&gt;&lt;TD&gt;12/06/2024 09:35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;CARNUMBER3&lt;/TD&gt;&lt;TD&gt;14/06/2023&lt;/TD&gt;&lt;TD&gt;ACTIVO&lt;/TD&gt;&lt;TD&gt;ENVIADO&lt;/TD&gt;&lt;TD&gt;14/06/2023 17:48&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;CARNUMBER3&lt;/TD&gt;&lt;TD&gt;02/06/2023&lt;/TD&gt;&lt;TD&gt;ENVIADO&lt;/TD&gt;&lt;TD&gt;PROCESS&lt;/TD&gt;&lt;TD&gt;02/06/2023 12:45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;CARNUMBER3&lt;/TD&gt;&lt;TD&gt;01/06/2023&lt;/TD&gt;&lt;TD&gt;PROCESS&lt;/TD&gt;&lt;TD&gt;PEDIDO&lt;/TD&gt;&lt;TD&gt;01/06/2023 08:55&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;How can I achieve this result?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 17:48:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4271112#M169396</guid>
      <dc:creator>Joaomatos2002</dc:creator>
      <dc:date>2024-11-05T17:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: STATUS HISTORY RANGE TIME</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4271193#M169408</link>
      <description>&lt;P&gt;To achieve a dynamic report that tracks the status of each card at any given point in time in Power BI, you can follow these steps. The key is to create a calculated column or measure that identifies the status of each card as of the selected date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here’s a step-by-step guide to setting it up:&lt;/P&gt;&lt;P&gt;Step 1: Create a Calendar Table&lt;BR /&gt;1. Create a Date table if you don’t have one. It should cover the entire range of dates in your dataset.&lt;BR /&gt;2. Make sure it has a column for month and year to allow you to filter by month.&lt;/P&gt;&lt;P&gt;Here’s a DAX formula to create the Date table:&lt;BR /&gt;DAX&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DateTable =
ADDCOLUMNS(
CALENDAR(MIN(YourTable[date]), MAX(YourTable[date])),
"Year", YEAR([Date]),
"Month", MONTH([Date]),
"MonthName", FORMAT([Date], "MMM"),
"Year-Month", FORMAT([Date], "YYYY-MM")
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Replace `YourTable[date]` with the actual date column in your history table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 2: Link the Calendar Table to Your Data Table&lt;BR /&gt;1. Go to the Model View in Power BI.&lt;BR /&gt;2. Create a relationship between the `DateTable`’s `[Date]` column and your history table’s `[date]` column.&lt;BR /&gt;3. Set the relationship as Many-to-One and Single Directional (from `DateTable` to your table).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 3: Create a Measure to Identify the Status as of the Selected Date&lt;BR /&gt;Use the `LASTNONBLANK` function to get the latest status before or on the selected date. This measure will check the last available status in history up to the selected date for each card.&lt;/P&gt;&lt;P&gt;DAX&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CardStatusAsOfSelectedDate =
VAR SelectedDate = MAX(DateTable[Date])
RETURN
CALCULATE(
LASTNONBLANKVALUE(YourTable[valuenew], [valuenew]),
FILTER(
YourTable,
YourTable[CARD_NUMber] = SELECTEDVALUE(YourTable[CARD_NUMber]) &amp;amp;&amp;amp;
YourTable[date] &amp;lt;= SelectedDate
)
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;This measure will dynamically return the latest status up to the selected date for each card.&lt;/P&gt;&lt;P&gt;Step 4: Create Measures for Total and Cumulative Counts&lt;BR /&gt;1. Total Count of Active Cards:&lt;BR /&gt;This measure calculates the total number of cards in "ACTIVO" status as of the selected date.&lt;BR /&gt;DAX&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TotalActiveCards =
CALCULATE(
COUNTROWS(YourTable),
FILTER(
YourTable,
[CardStatusAsOfSelectedDate] = "ACTIVO"
)
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;2. Cumulative Total of Active Cards:&lt;BR /&gt;This measure calculates the cumulative count of cards that were ever active up to the selected date.&lt;BR /&gt;DAX&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CumulativeActiveCards =
CALCULATE(
COUNTROWS(YourTable),
FILTER(
ALL(DateTable),
DateTable[Date] &amp;lt;= MAX(DateTable[Date]) &amp;amp;&amp;amp;
[CardStatusAsOfSelectedDate] = "ACTIVO"
)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 5: Build the Report&lt;BR /&gt;1. Add a slicer for `DateTable[Date]` so that you can select any date.&lt;BR /&gt;2. Use a Matrix or Table visual to display `CARD_NUMber` and the `[CardStatusAsOfSelectedDate]` measure to see the status of each card at the selected date.&lt;BR /&gt;3. Add a Card Visual or KPI to display `TotalActiveCards` and `CumulativeActiveCards` for dynamic counts based on the date selection.&lt;/P&gt;&lt;P&gt;This setup will give you a dynamic view of each card’s status history over time, and you can adjust the date slicer to see the status for any month or cumulative total.&lt;/P&gt;&lt;P&gt;If you have any further customization needs, feel free to ask!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 18:16:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4271193#M169408</guid>
      <dc:creator>FarhanJeelani</dc:creator>
      <dc:date>2024-11-05T18:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: STATUS HISTORY RANGE TIME</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4272828#M169494</link>
      <description>&lt;P&gt;Thank you for your time.&lt;BR /&gt;step1, step2 : check&lt;BR /&gt;Step 3:&lt;/P&gt;&lt;P&gt;What I want is the latest stats for each card up to a selected date. If I set a date range from 01-01-2024 to 05-11-2024, it should display only the most recent stats of each card, regardless of when that last update was (even if it was, for example, in March). When I add records to a table, it currently shows all stats for each card, which it shouldn't. I only need the most recent stats for each card.&lt;/P&gt;&lt;H3&gt;Step 4:&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;The code works, but it's retrieving all statuses for each card and counting them. For example, if a card has had 150 stats updates, when I filter the report for that card, the total count of cards should be 1, not 150 as it is now.&lt;/LI&gt;&lt;LI&gt;I would like the cumulative total of active stats within the date range, as the tables should update based on this time interval filter.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 17:26:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4272828#M169494</guid>
      <dc:creator>Joaomatos2002</dc:creator>
      <dc:date>2024-11-06T17:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: STATUS HISTORY RANGE TIME</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4273751#M169545</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="761233" data-lia-user-login="Joaomatos2002" class="lia-mention lia-mention-user"&gt;Joaomatos2002&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please update the formula of measure as below and check if it can return the expected result.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _date =
    SELECTEDVALUE ( 'Date'[date] )
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[CARD_NUMber],
        "@maxdate",
            CALCULATE (
                MAX ( 'Table'[date] ),
                FILTER ( 'Table', 'Table'[CARD_NUMber] = EARLIER ( 'Table'[CARD_NUMber] ) )
            )
    )
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[CARD_NUMber] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[CARD_NUMber] = MAXX ( _tab, [CARD_NUMber] )
                &amp;amp;&amp;amp; 'Table'[date] &amp;lt;= _date
                &amp;amp;&amp;amp; 'Table'[date] &amp;lt;= MAXX ( _tab, [@maxdate] )
        )
    )
RETURN
    COUNTROWS ( _tab )&lt;/LI-CODE&gt;
&lt;P&gt;If the above one can't help you figure out, please&amp;nbsp;&lt;SPAN&gt;provide more&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;raw data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;in your tables&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;) with&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;format&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and your&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-provide-sample-data-in-the-Power-BI-Forum%2Fba-p%2F963216&amp;amp;data=05%7C01%7CClaire.Dong%40microsoft.com%7Cada9149bd91546a8432508dacd31ef9b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638047911607737134%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=EJlYfclgtrjgAEYj9Uo1AauqxaQm3hlQsjJMo4zCY1M%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2024 09:36:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4273751#M169545</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-07T09:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: STATUS HISTORY RANGE TIME</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4275840#M169648</link>
      <description>&lt;P&gt;Thanks for your time...&lt;BR /&gt;I apologize for the delay.... but I finally managed to do what I wanted, I had to adjust some things in the codes...&lt;BR /&gt;Here are the codes I changed and adjusted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CardStatusAsOfSelectedDate = 
VAR SelectedDate = MAX('DateTable'[Date])  -- Define a data selecionada
RETURN
CALCULATE(
    LASTNONBLANKVALUE( 
        'Tabela_B'[VALUE_NEW], 
        MAX('Tabela_B'[VALUE_NEW])
    ),
    FILTER(
        'Tabela_B',
        'Tabela_B'[CARD_NUM] = SELECTEDVALUE('Tabela_B'[CARD_NUM]) &amp;amp;&amp;amp;
        'Tabela_B'[CREATEDATE] &amp;lt;= SelectedDate
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the same way that I went to get the last status, I also chose to go to the last date:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LastCreatedOnAsOfSelectedDate = 
VAR SelectedDate = MAX('DateTable'[Date])
RETURN
CALCULATE(
    MAX('Tabela_B'[CREATEDATE]),
    FILTER(
        'Tabela_B',
        'Tabela_B'[CARD_NUM] = SELECTEDVALUE('Tabela_B'[CARD_NUM]) &amp;amp;&amp;amp;
        'Tabela_B'[CREATEDATE] &amp;lt;= SelectedDate
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use both to calculate the total number of cards:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TotalCards = 
VAR CardStatusTable =
    ADDCOLUMNS(
        SUMMARIZE(
            'Tabela_B',
            'Tabela_B'[CARD_NUM]
        ),
        "LastStatus", [CardStatusAsOfSelectedDate],
        "LastDate", [LastCreatedOnAsOfSelectedDate]
    )
RETURN
CALCULATE(
    COUNTROWS(CardStatusTable),
    FILTER(
        CardStatusTable,
        [LastStatus] &amp;lt;&amp;gt; "PED_REJECT" &amp;amp;&amp;amp;
        [LastStatus] &amp;lt;&amp;gt; "CANCELADO" &amp;amp;&amp;amp;
        [LastStatus] &amp;lt;&amp;gt; ""
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only thing I couldn't do was the "accumulated", that is, when I present the measure in the matrix table, the data that should be presented should count from the beginning of the data entry to the current line of the matrix, to have a notion of the evolution over time.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If you think I'm doing something wrong, I would appreciate it if you could also give me some tips!!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If anyone can give a hint in this code that I am missing, I would appreciate it...&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 15:35:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4275840#M169648</guid>
      <dc:creator>Joaomatos2002</dc:creator>
      <dc:date>2024-11-08T15:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: STATUS HISTORY RANGE TIME</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4279230#M169800</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="761233" data-lia-user-login="Joaomatos2002" class="lia-mention lia-mention-user"&gt;Joaomatos2002&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thanks for your feedback. Please &lt;STRONG&gt;update&lt;/STRONG&gt; the formula of measure [TotalCards] as below and check if it can return the expected result...&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TotalCards = 
VAR CardStatusTable =
    ADDCOLUMNS (
        SUMMARIZE ( 'Tabela_B', 'Tabela_B'[CARD_NUM] ),
        "LastStatus", [CardStatusAsOfSelectedDate],
        "LastDate", [LastCreatedOnAsOfSelectedDate]
    )
VAR _lastdate =
    MAXX ( CardStatusTable, [LastDate] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Tabela_B'[CARD_NUM] ),
        FILTER (
            ALLSELECTED ( 'Tabela_B' ),
            'Tabela_B'[CREATEDATE] &amp;lt;= SELECTEDVALUE ( 'DateTable'[Date] )
                &amp;amp;&amp;amp; 'Tabela_B'[CREATEDATE] = _lastdate
                &amp;amp;&amp;amp; NOT ( 'Tabela_B'[VALUE_NEW] IN { "PED_REJECT", "CANCELADO", "" } )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;If the above one can't help you figure out, please&amp;nbsp;&lt;SPAN&gt;provide more&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;raw data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;in your tables&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;) with&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;format&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and your&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-provide-sample-data-in-the-Power-BI-Forum%2Fba-p%2F963216&amp;amp;data=05%7C01%7CClaire.Dong%40microsoft.com%7Cada9149bd91546a8432508dacd31ef9b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638047911607737134%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=EJlYfclgtrjgAEYj9Uo1AauqxaQm3hlQsjJMo4zCY1M%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 06:23:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/STATUS-HISTORY-RANGE-TIME/m-p/4279230#M169800</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-12T06:23:14Z</dc:date>
    </item>
  </channel>
</rss>

