Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX Count under condition

Hey everyone, I have a DAX question for you. I have a data set that contains settled income of people on benefits. This income is recorded monthly by date. To see which people have received new inc...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous,

    Perhaps you can try to use the following calculated column formula to check the records based on client group and date range conditions to remark the suitable records:

    InCome? = 
    VAR result =
        COUNTROWS (
            FILTER (
                'T2',
                VAR currClient =
                    EARLIER ( T2[Client] )
                VAR currDate =
                    EARLIER ( T2[Date] )
                RETURN
                    [Client] = currClient
                        && [Date]
                            > DATE ( YEAR ( currDate ), MONTH ( currDate ) - 3, DAY ( currDate ) )
                        && [Date] < currDate
            )
        )
    RETURN
        IF ( result > 0, "No", "Yes" )

    Regards,

    Xiaoxin Sheng