Forum Discussion

cottrera's avatar
cottrera
Post Prodigy
3 years ago
Solved

DAX count if dates < or >= relating date

Hi   I have two tables that are related via the Property Ref column.   Table 1 - Property (1 row per property) Property Ref Address Inspection Date DAX - repair count < repair date DAX - ...
  • v-zhangti's avatar
    3 years ago

    Hi, cottrera 

     

    You can try the following methods.

    Column:

    repair count < repair date = 
    CALCULATE (
        COUNT ( Repairs[Property Ref] ),
        FILTER (
            Repairs,
            [Repair Date] < EARLIER ( 'Property'[Inspection Date] )
                && [Property Ref] = EARLIER ( 'Property'[Property Ref] )
        )
    )
    repair count > repair date = 
    CALCULATE (
        COUNT ( Repairs[Property Ref] ),
        FILTER (
            Repairs,
            [Repair Date] >= EARLIER ( 'Property'[Inspection Date] )
                && [Property Ref] = EARLIER ( 'Property'[Property Ref] )
        )
    )

    Is this the result you expect?

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.