Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Problem with getting the previus value when using time

Hi,

I have a strange problem that i think this community can help me with.
I using this DAX 

TEst = LOOKUPVALUE(Tabell[Value],Tabell[Tid], Tabell[Tid]- (TIME(1,0,0)))

To test if i can get the prevuis value 


Why do i get some values and others not?

  • Some of your timestamps contain fractions of seconds.  Force the Tid column to drop these fractions.

     

    Also please don't use LOOKUPVALUE for that.  Use a proper function like OFFSET.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi lbendlin ,thanks for the quick reply, I'll add further.

    Hi Anonymous ,

    The Table data is shown below:

    Use the following DAX expression to create a measure

    Measure = CALCULATE(MAX('Table'[Value]),OFFSET(-1,ALLSELECTED('Table'[Value]),ORDERBY('Table'[Value],ASC)))

    Final output

     

4 Replies