Forum Discussion

iiomarioii's avatar
iiomarioii
Helper II
6 years ago
Solved

Date when value is negative

Hi guys, 

 

this is my table: 

Table1:

DateItem numberQuantity (Measure) 
01.01.2020  1     10
02.01.2020  1   5
03.01.2020  1  0
04.01.2020  1 -5
01.01.2020  2  12
02.01.2020  2  3
03.01.2020  2  -2
04.01.2020  2   -5

Quantitiy = CALCULATE (

SUM ( Inventory[Quantity] ),
FILTER (ALL (Date), 'Date'[Date] <= MAX ( 'Date'[Date])))
 

I have different items with decreasing values and I need a table showing me the date of the different items, when the value is positive (>0) for the last time. 

 

So for example: 

Table2:

Item numberDate 
103.01.2020
202.01.2020

 

Any ideas? 🙂 

 

Thank you! 

  • Hi iiomarioii,

     

    Try add filter to the formula.

    positive =
    IF (
        'Gesamt2'[Date]
            = CALCULATE (
                MAX ( 'Date'[Date] ),
                FILTER ( ALLEXCEPT ( Tablle1, 'Tablle1'[Artikelnummer] ), [total] >= 0 )
            ),
        'Gesamt2'[Date],
        BLANK ()
    )

     

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

12 Replies