Forum Discussion

jsierkstra's avatar
jsierkstra
Frequent Visitor
3 years ago
Solved

How to model date relationship on multiple date columns

Hi,   I have a problem which seems easy to solve but I am not able to. Let's explain. I will simplify this in order to make it more clear.   I have a table, let's callet it Pallets. This table ha...
  • TonyZhou1980's avatar
    3 years ago

    I tried to create a measure as below, and in the visual, set the "Still in Stock" in slice pane to equal to "yes", add a data[data] slice,

    Still in Stock =
    var _datein = calculate(max('palletcode'[Date In]),allexcept(palletcode,palletcode[Date In]))
    var _dateout = CALCULATE(max('palletcode'[Date Out]),allexcept(palletcode,'palletcode'[Date Out]))
    Var result =
        if(
            selectedvalue('Date'[Date])>=_datein && or(selectedvalue('Date'[Date])<=_dateout,_dateout=date(1753,1,1)),
            "Yes",
            "No"
        )
    return
            if(ISINSCOPE(palletcode[Date In]),result,BLANK())
     
    If you know how to attach the sample file, please tell me then I can attach the file for your reference.