Forum Discussion

yogesh9ngp's avatar
yogesh9ngp
New Member
6 years ago
Solved

Want to Delete and Retain Rows based on a Specific Value in the Column

Hello, I am working on a project and I am stuck on a problem. I want to delete Rows based on multiple conditions on more than one column. Following is the Example of the Data.   Customer_Number ...
  • v-frfei-msft's avatar
    6 years ago

    Hi yogesh9ngp ,

     

    We can create a calculated table as below.

    Table 2 = 
    VAR k =
        ADDCOLUMNS (
            'Table',
            "A",
            VAR a =
                ADDCOLUMNS (
                    'Table',
                    "days", ABS ( DATEDIFF ( TODAY (), 'Table'[Date], DAY ) )
                )
            VAR days_ =
                ABS ( DATEDIFF ( TODAY (), 'Table'[Date], DAY ) )
            VAR b =
                MINX (
                    FILTER (
                        a,
                        'Table'[Appointment_Status] = EARLIER ( 'Table'[Appointment_Status] )
                    ),
                    [days]
                )
            VAR s =
                CALCULATE (
                    COUNTROWS ( 'Table' ),
                    FILTER (
                        'Table',
                        'Table'[Appointment_Status] = "S"
                            && 'Table'[Appointment_Status] = EARLIER ( 'Table'[Appointment_Status] )
                    )
                )
            RETURN
                IF (
                    days_ = b
                        && 'Table'[Appointment_Status] <> "S",
                    "NO- Appointment Scheduled",
                    IF ( 'Table'[Appointment_Status] = "S", "Appointment Scheduled" )
                )
        )
    RETURN
        FILTER ( k, [A] <> BLANK () )