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
Joachimnicho
Frequent Visitor

Return a value based upon the latest date

Hi, 

 

I need help with an issue. 

 

I have a column with a project number [Projektnr], which has a delivery type [Leverancetype].

The [Projektnr] column has some duplicates. Whenever there is a duplicate, I need to return the [Leverancetype], which has the latest date [Datostempel]. 

 

I have tried using a variation of LOOKUPVALUE formulas, MAXX formulas etc., but cannot seem to make it work. 

 

I have posted a screenshot of the table to make the abovementioned more clear. 

 

 

TableTable

I would really appreciate, if anyone could help me with my issue!!

 

Regards

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Joachimnicho,

 

You may refer to the following DAX that creates a new table.

Table =
FILTER (
    Table1,
    RANKX (
        CALCULATETABLE ( Table1, ALLEXCEPT ( Table1, Table1[Projektnr] ) ),
        Table1[Datostempel],
        ,
        DESC,
        DENSE
    )
        <= 1
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@Joachimnicho,

 

You may refer to the following DAX that creates a new table.

Table =
FILTER (
    Table1,
    RANKX (
        CALCULATETABLE ( Table1, ALLEXCEPT ( Table1, Table1[Projektnr] ) ),
        Table1[Datostempel],
        ,
        DESC,
        DENSE
    )
        <= 1
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Abduvali
Skilled Sharer
Skilled Sharer

Hi @Joachimnicho,

 

 

Just try this:

Create new column: Latest Date = if(Sheet3[Date]=max(Sheet3[Date]),"Latest","")

and then just filter by "Latest"

 

 

Hope this helps.

 

 

Regards

Abduvali

The problem is, that I need to return the [Leverancetype] for all the [Projektnr], but take the [Projektnr] and corresponding [Leverancetype] with the latest date [Datostempel] if the [Projektnr] is duplicated. 

 

As a last thing. When this works out, I need to return the value [Leverancetype] in a different table, with a LOOKUPVALUE(Projektspec[Leverancetype]; 'Projektspec'[Projektnr];'Job Task'[Projektnr]), without it saying:

 

"A table of multiple values was supplied where a single value was expected"

 

So basically, I need to attach a filter to my LOOKUPVALUE, which makes it return the [Leverancetype] for all [Projektnr] and the [Leverancetype] with the latest date if the [Projektnr] is duplicated. 

 

Hope this made my situation more clear

 

Regards

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.