Forum Discussion

Hamzehn's avatar
Hamzehn
Frequent Visitor
4 years ago
Solved

Best Practices for Complex Date Filters

[I apologize as I believe I posted this first under the wrong forum - deleted that post and reposting here] Hi everyone, I'm working with a model that has a large table of contracts (100s of thousan...
  • amitchandak's avatar
    amitchandak
    4 years ago

    Hamzehn , You can try like

     


    new measure =
    var _max = maxx(allselected(Date),Date[Date])
    var _min = minx(allselected(Date),Date[Date])
    return
    calculate( sum(contracts_table[Value]), filter(contracts_table, contracts_table[expiry_date] >= _max || ISBLANK([expiry_date])​) )


    new measure =
    var _max = maxx(allselected(Date),Date[Date])
    var _min = minx(allselected(Date),Date[Date])
    return
    calculate( sum(contracts_table[Value]), filter(contracts_table,contracts_table[contract_status] <> "CANCEL" || contracts_table[cancellation_date] > _max
    ​) )