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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vbourbeau
Resolver II
Resolver II

Find the last job by date

Hi look the below image it's what I'm looking to do :

Capture.PNG

 

at the left it's the table and at the right the graph. The graph must be only the last job, here it's job B since it's today (in the real table I have also minutte so no duplication date possible)

For this example I hard code the job number on the page filter but in real live I want it dynamic.

 

here the source: https://we.tl/t-4PI5U5MJxC

 

1 ACCEPTED SOLUTION

Hello @vbourbeau - you can try this

Create a Measure The Last Work

Last Job =
CALCULATE (
    LASTNONBLANKVALUE ( Jobs[date], MAX ( Jobs[Job] ) ),
    ALL ( Jobs[Job] )
)

Create an IsLastJob measure

IsLastJob =
IF ( SELECTEDVALUE ( Jobs[Job] ) = [Last Job], 1, 0 )

Create the chart with Cycle as an X axis, Value as y-axis, and Work as legend. Next, add IsLastJob in the visual filters and set it to 1 (it's 1).

2020-09-14 15_49_59-Window.png

I hope this helps

David

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@vbourbeau This is essentially Lookup Min/Max - https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434

 

In your case:

Measure = 
  VAR __MaxDate = MAX('Table',[date])
RETURN
  MAXX(FILTER('Table',[date]=__MaxDate),[value])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

We are close but I think we need to link with the JOB number.

 

Here a put another example with time and more cycle for the JOB "C". Look the cycle 4 is add but JOB "B" don't have 4 cycle.

code: https://we.tl/t-c3d78EnaA7

 

Capture.PNG

Hello @vbourbeau - you can try this

Create a Measure The Last Work

Last Job =
CALCULATE (
    LASTNONBLANKVALUE ( Jobs[date], MAX ( Jobs[Job] ) ),
    ALL ( Jobs[Job] )
)

Create an IsLastJob measure

IsLastJob =
IF ( SELECTEDVALUE ( Jobs[Job] ) = [Last Job], 1, 0 )

Create the chart with Cycle as an X axis, Value as y-axis, and Work as legend. Next, add IsLastJob in the visual filters and set it to 1 (it's 1).

2020-09-14 15_49_59-Window.png

I hope this helps

David

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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