Forum Discussion

saddas's avatar
saddas
Frequent Visitor
4 years ago
Solved

Calculate Sum Excluding Specific Dates

I have a data set that includes the following columns: Table 1: Date, City, Value. I would like to Sum the values for a specific city, while also excluding specific dates. I tried the following fo...
  • amitchandak's avatar
    4 years ago

    saddas , try like

    Paris Profit =

    CALCULATE(

    SUM( 'Table 1'[Value] ),

    'Table 1'[City] = “Paris”,

    filter('Table 1'

    not ( 'Table 1'[Date] = date(2021,01,19) || 'Table 1'[Date] = date(2021,04,21) )

    )

    )

  • smpa01's avatar
    4 years ago

    saddas  change to this

    Paris Profit =
    CALCULATE (
        SUM ( 'Table 1'[Value] ),
        'Table 1'[City] = "Paris",
        KEEPFILTERS (
            'Table 1'[Date]
                IN { DATE ( 2021, 1, 19 ), DATE ( 2021, 4, 2 ) } = FALSE
        )
    )