Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

FIXED SUM

i want to find out the sum of the stock except latest stock count(i.e latest stock count date is 4/28/2019)and previous stock count(i.e prevoious stock count date is 4/4/2019)

i want to find out the sum of the stock excpet mindate(i.e 4/4/2019) and maxdate(i.e 4/24/2019). i want the sum of remaining dates. the requrired output is as sales between latest and previous column.

  • Hi Anonymous ,

     

    You can create a new column to do it.

    Column =
    VAR mind =
        MIN ( test[date] )
    VAR maxd =
        MAX ( test[date] )
    RETURN
        IF (
            OR ( test[date] = mind, test[date] = maxd ),
            BLANK (),
            SUMX ( FILTER ( test, test[date] > mind && test[date] < maxd ), test[stock] )
        )
    

    Or you can use a new measure to do it.

    Measure 2 =
    VAR mind =
        MIN ( test[date] )
    VAR maxd =
        MAX ( test[date] )
    RETURN
        CALCULATE ( SUM ( test[stock] ), test[date] > mind && test[date] < maxd )
    

     

    Best Regards,

    Eads

     

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

     

1 Reply

  • v-eachen-msft's avatar
    v-eachen-msft
    Community Support

    Hi Anonymous ,

     

    You can create a new column to do it.

    Column =
    VAR mind =
        MIN ( test[date] )
    VAR maxd =
        MAX ( test[date] )
    RETURN
        IF (
            OR ( test[date] = mind, test[date] = maxd ),
            BLANK (),
            SUMX ( FILTER ( test, test[date] > mind && test[date] < maxd ), test[stock] )
        )
    

    Or you can use a new measure to do it.

    Measure 2 =
    VAR mind =
        MIN ( test[date] )
    VAR maxd =
        MAX ( test[date] )
    RETURN
        CALCULATE ( SUM ( test[stock] ), test[date] > mind && test[date] < maxd )
    

     

    Best Regards,

    Eads

     

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