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
JCK2
Helper III
Helper III

Get latest value based on max date

Hello!!!

 

I want to get the latest target based on the latest date and for the date format has time also, so basically the latest value based on max date and time.

 

The expeted output of this is 95, i have used max date funcation but it does not seem to work.

 

Project NameModified DateTarget
BASIC13-Dec-22 14:00     95
BASIC

13-Dec-22

13:00

    90
BASIC

13-Dec-22

12:00

   85

 

Any suggest, how to get this working? Thanks a lot in advance!!

 

 

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @JCK2 

 

try to plot a visual table with a measure of this:

Target2 =
VAR _value = MAXX(TableName, TableName[ModifiedDate])
RETURN
MAXX(
    FILTER(TableName, TableName[ModifiedDate] =_value),
    TableName[Target]
)
 
i tried and it worked like this:
FreemanZ_0-1670939453228.png

the dataset:

FreemanZ_1-1670939491171.png

 

View solution in original post

6 REPLIES 6
JCK2
Helper III
Helper III

Thanks everyone! let me try them 🙂

FreemanZ
Super User
Super User

hi @JCK2 

 

try to plot a visual table with a measure of this:

Target2 =
VAR _value = MAXX(TableName, TableName[ModifiedDate])
RETURN
MAXX(
    FILTER(TableName, TableName[ModifiedDate] =_value),
    TableName[Target]
)
 
i tried and it worked like this:
FreemanZ_0-1670939453228.png

the dataset:

FreemanZ_1-1670939491171.png

 

it can be further simplified like this:

Target3 =
VAR _value = MAX(TableName[ModifiedDate])
RETURN
MAXX(
    FILTER(TableName, TableName[ModifiedDate] =_value),
    TableName[Target]
)
latimeria
Solution Specialist
Solution Specialist

Hi @JCK2 ,

 

Something like this:

//get max date for 1 project
VAR MaxDate = calculate( max('table'[Modified Date]), allexcept('table, 'table'[project name]))
RETURN

//get target for max date for the project. Instead of max, you can use min as you retrieve only 1 value

//assumpton: you have a relationship between table date & project date
calculate( max('table'[Target]), datetable[date] = MaxDate)

JW_van_Holst
Resolver IV
Resolver IV

_TargetMaxDate = 
VAR __filer = MAX('Table'[Modified Date])
VAR __target = CALCULATE(SELECTEDVALUE('Table'[Target]), 'Table'[Modified Date] = __filer)
RETURN
__target

Picture2.png

 

philouduv
Resolver III
Resolver III

Hello @JCK2 ,

If you only want the target create this measure to give you the last value of target:

philouduv_0-1670938455765.png

If you also want the latest date associated create an other measure like this 

philouduv_1-1670938497548.png



Hope it helps you

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