Forum Discussion

Joaomatos2002's avatar
Joaomatos2002
Frequent Visitor
1 year ago
Solved

STATUS HISTORY RANGE TIME

Good afternoon, 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 t...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Joaomatos2002 ,

    Thanks for your feedback. Please update the formula of measure [TotalCards] as below and check if it can return the expected result...

    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] <= SELECTEDVALUE ( 'DateTable'[Date] )
                    && 'Tabela_B'[CREATEDATE] = _lastdate
                    && NOT ( 'Tabela_B'[VALUE_NEW] IN { "PED_REJECT", "CANCELADO", "" } )
            )
        )

    If the above one can't help you figure out, please provide more raw data in your tables(exclude sensitive data) with Text format and your expected result 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:

    How to provide sample data in the Power BI Forum

     

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards