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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Lastnonblank with Date and Hour

Hi there, 

 

I'm trying to develop a dash that gets the dock status at the time of order, must select the last modification date and time value, but i can't make it work.

 

kelvinbravin_0-1642429139969.png

 

 

kelvinbravin_0-1642428544147.png

 

It was expected that orders placed after 15:00 the value 0

 

The table below shows the values to be searched for:

 

kelvinbravin_2-1642428780537.png

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@smpa01I got it, thank you very much!!!


Solution:

 

data alteração =
var data = CALCULATE(
lastNONBLANK(Handling[Data], true()),
FILTER(ALL(Handling[Data]),
Handling[Data] <= Pedidos[Data e hora])
)
 
var handl = LOOKUPVALUE(Handling[Status doca],Handling[Data],data)

return
handl


kelvinbravin_0-1642450865106.png

 

View solution in original post

11 REPLIES 11
smpa01
Super User
Super User

@Anonymous  you can create a column like this

Column =
VAR _x =
    FILTER ( Pedidos, Pedidos[Data] = MAX ( Pedidos[Data] ) )
RETURN
    IF ( Handling[Data e hora] >= MAXX ( _x, [Data] ), MAXX ( _x, [Doca] ) )

 

 

smpa01_0-1642433826689.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

but I need data in all columns that have dock modification, in which case it's only showing from the last day. I needed something like the print I sent, but the values shouldn't all return 1.

@Anonymous  I am not sure what do you mean.

 

The max datetime in Handling is 2021-12-13 03:00:00 PM

 

smpa01_0-1642440024148.png

 

Do you want to identify the rows in Pedidos that has Pedios[Data e hora] greater than MAX(

Handling[Data]) and get the corresponding value? I am not understanding correctly.

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

@smpa01I need to know the status of the dock at the time of order, like this example:

 

kelvinbravin_0-1642440992144.png

 

Order dateExpected result Last modificationStatus 
17/01/2022 08:000 17/01/2022 05:000
17/01/2022 11:151 17/01/2022 11:001
17/01/2022 13:001 17/01/2022 15:000
17/01/2022 14:001   
17/01/2022 15:300   
17/01/2022 16:000   
     

@Anonymous  what is the relationship between these two tables?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

@smpa01  The table I sent at the beginning was for tests I was doing.

The dock status table changes at certain times by changing the values between 0, 1 and 2

The order table I need to have the dock status at the time of order.

For example:
At 08:00 AM - status 2
At 10:00 AM - status 1
At 02:00 PM - status 0

Orders created between 08:00 AM and 09:59 AM must return dock 2 status
Orders created between 10:00 AM and 01:59 PM must return dock 1 status
Orders created after 14:00 PM must return dock status 0

@Anonymous  can you please create a sample pbix, upload in 1/g drive or any other file hosting service and share the url here?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable
Anonymous
Not applicable

@smpa01I got it, thank you very much!!!


Solution:

 

data alteração =
var data = CALCULATE(
lastNONBLANK(Handling[Data], true()),
FILTER(ALL(Handling[Data]),
Handling[Data] <= Pedidos[Data e hora])
)
 
var handl = LOOKUPVALUE(Handling[Status doca],Handling[Data],data)

return
handl


kelvinbravin_0-1642450865106.png

 

smpa01
Super User
Super User

@Anonymous  provide the sample data in table format here

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

Orders

PedidoData e horaQuantidade
1709/12/2021 14:00161
1809/12/2021 15:30444
1910/12/2021 14:00434
2010/12/2021 15:30414
2111/12/2021 14:00420
2211/12/2021 15:30338
2312/12/2021 14:00244
2412/12/2021 15:30230
2513/12/2021 14:00430
2613/12/2021 15:30153

Status dock

DataDoca
12/12/2021 14:001
12/12/2021 15:000
13/12/2021 08:001
13/12/2021 15:000
11/12/2021 06:001
11/12/2021 15:000

Dax 

 

Handling = CALCULATE(
LASTNONBLANK(Handling[Doca], true()),
FILTER(ALL(Handling[Data]),
Handling[Data] <= Pedidos[Data e hora])
)

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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