Forum Discussion

jcarb0321's avatar
jcarb0321
New Member
5 years ago
Solved

Returning a value when considering multiple criteria in an array

Hello,   Basically I have a table of Dates, Patients, Providers, and Procedure Codes. I need to return another value if a Patient Visit on a particular Date, with a particular Provider has 2 specif...
  • v-yingjl's avatar
    5 years ago

    Hi jcarb0321 ,

    You can create this calculate column:

    A = 
    VAR _count =
        CALCULATE (
            DISTINCTCOUNT ( 'Table'[Procedure Category ID] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[Procedure Category ID] <> "Non-Covid"
                    && 'Table'[Svc_Date] = EARLIER ( 'Table'[Svc_Date] )
                    && 'Table'[Patient ID] = EARLIER ( 'Table'[Patient ID] )
                    && 'Table'[Provider ID] = EARLIER ( 'Table'[Provider ID] )
            )
        )
    RETURN
        SWITCH (
            TRUE (),
            _count >= 2, "Office Visit and Covid Test",
            _count = 1, "Only " & [Procedure Category ID]
        )

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.