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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anders_Dahl
Frequent Visitor

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

v-zhouwen-msft
Community Support
Community Support

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

Hi @Anders_Dahl ,

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
v-zhouwen-msft
Community Support
Community Support

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

Hi @Anders_Dahl ,

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.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Kudoed Authors