Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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 

Anders_Dahl_0-1715118353333.png


Why do i get some values and others not?

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

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.

View solution in original post

Anonymous
Not applicable

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

Hi @Anonymous ,

The Table data is shown below:

vzhouwenmsft_0-1715592199323.png

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

vzhouwenmsft_1-1715592265564.png

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

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

Hi @Anonymous ,

The Table data is shown below:

vzhouwenmsft_0-1715592199323.png

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

vzhouwenmsft_1-1715592265564.png

 

lbendlin
Super User
Super User

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
Not applicable

HI @lbendlin 
It would be great if you could show an example when using OFFSET.
In documents it looks like the OFFSET works best in a MEASURE. Is that correct?

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.