Min date minus 1

Hi every one I trying to return the min date minus 1 in filter is doesn’t work .

My measure now :
CALCULATE(SUM('DW MT4_DAILY_MD_view'[EQUITY]),FILTER(DimDate,DimDate[Date] = MIN(DimDate[Date])) -its working good

And i want
CALCULATE(SUM('DW MT4_DAILY_MD_view'[EQUITY]),FILTER(DimDate,DimDate[Date] = MIN(DimDate[Date])-1))

Use ALL ( DimDate ) otherwise at the current cell the only date you get is the date from that cell, if you want dates from past or future for evaluation in the current cell then you need to return all the dates and then traverse accordingly.

=
VAR MinDate =
    MIN ( DimDate[Date] ) - 1
VAR Result =
    CALCULATE (
        SUM ( 'DW MT4_DAILY_MD_view'[EQUITY] ),
        FILTER ( ALL ( DimDate ), DimDate[Date] = MinDate )
    )
RETURN
    Result

image
Here is a compact code.

=
VAR MinDate =
    MIN ( DimDate[Date] ) - 1
VAR Result =
    CALCULATE (
        SUM ( 'DW MT4_DAILY_MD_view'[EQUITY] ),
        DimDate[Date] = MinDate,
        REMOVEFILTERS ( DimDate )
    )
RETURN
    Result
2 Likes

The problem is not a filter . I think problem is that DimDate[Date] is date type
and MIN(DimDate[Date])-1 is date/time type .
how I change MIN(DimDate[Date])-1 to date

That happens implicitly, you don’t need to do that.

when I do MIN(DimDate[Date])-1 I get value

but then i put it in CALCULATE it blank

and for DimDate[Date] = MinDate i get arrow
“A function ‘CALCULATE’ has been used in a True/False expression that is used as a table filter expression. This is not allowed.”

That’s weird, share a screenshot of the code that you are trying to run with the error.

Thank you very much .Now it work .Maybe I did something wrong.