Forum Discussion

awitt's avatar
awitt
Helper III
6 years ago
Solved

Conditional Measure Based on Date

I have a set of data that has one record per OrderItemId which is a specific unit of a sale. I have two columns, CONDATE which is the begging date of this sale and FINALDATE which is when the sale cl...
  • v-lid-msft's avatar
    v-lid-msft
    6 years ago

    Hi awitt ,

     

    We can try to use the following measure to meet your requirement:

     

    Count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[OrderItemID] ),
        FILTER (
            'Table',
            OR (
                ISBLANK ( 'Table'[FINALDATE] ),
                NOT (
                    OR (
                        'Table'[CONDATE] > MAX ( 'DateSlicer'[Date] ),
                        'Table'[FINALDATE] <= MIN ( 'DateSlicer'[Date] )
                    )
                )
            )
        )
    )


    Best regards,