Forum Discussion

NewData's avatar
NewData
Frequent Visitor
4 years ago
Solved

Return first value in given hour range over multiple dates

Hello, I am trying to only return a "1" when a particular model reaches certain set of ranges. Currently, my data keeps returning duplicates. Returns 1 each time that unit is in that range.  Exa...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi NewData ,

    If you want to chenge the measure to a column, please have a try.

    column=
    var _min=minx(filter(allselected(table),table[model=earlier(table[model])&&((value>=10||value<=15)&&value>=20||value<=25))),table[date])
    return 
    if(table[date]=_min,1,0)

    If I have misunderstood your meaning, please provide the output you want in the form of a picture.

     

    Best Regards
    Community Support Team _ Polly

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

  • NewData's avatar
    4 years ago

    Anonymous 

     

    I was able to modify your code to get desired solution

    column=
    var _min1=minx(filter(allselected(table),table[model=earlier(table[model])&&((value>=10&&value<=15))),table[date])
    var _min2=minx(filter(allselected(table),table[model=earlier(table[model])&&((value>=20&&value<=25))),table[date])
    return
    if(table[date]=_min1,1,

        If(table[date]=_min2,1,

    0))

    Thank you for assistance.