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
rpinxt
Impactful Individual
Impactful Individual

Get Max date for every delivery. Calculated column?

rpinxt_0-1668008450196.png

This is the situation:

A delivery with several log dates.

I linked log date to my date table to get it in periods.

 

Because there are 2 log dates (in this case. many times even more) this delivery will pop up in 2 periods.

I want it to only pop up in the latest period.

 

So I was thinking create a calculated column to get the max date for every delivery.

In this case both lines should get date 2-1-22.

 

That column I would then link to my date table instead of the column Log Date.

So in that way the delivery should only show up in 1 period.

 

Would this the best way?

And if yes how what that calculated column look?
Guess max([log date]) will not be enought because it has to reset at every delivery number.

2 ACCEPTED SOLUTIONS
v-shex-msft
Community Support
Community Support

HI @rpinxt,

You can try to use the EARLIER function with iterator function MAXX to get the max date based on current field values and use it as formula conditions.

newColumn =
MAXX ( FILTER ( Table, [delivery] = EARLIER ( Table[delivery] ) ), [log date] )

EARLIER vs EARLIEST in DAX - Excelerator BI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula will work

Revised log date = calculate(max(Data[Log date]),filter(Data,Data[Delivery]=earlier(Data[Delivery])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
rpinxt
Impactful Individual
Impactful Individual

Thanks @Ashish_Mathur @v-shex-msft !

 

Both your solutions worked like a charm :

rpinxt_0-1668077316292.png

And if I then take out log date it consolidates to 1 line with only the 10 in period 2 as I wanted 😄

rpinxt_1-1668077371805.png

 

Thanks again guys! Very helpful

Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula will work

Revised log date = calculate(max(Data[Log date]),filter(Data,Data[Delivery]=earlier(Data[Delivery])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-shex-msft
Community Support
Community Support

HI @rpinxt,

You can try to use the EARLIER function with iterator function MAXX to get the max date based on current field values and use it as formula conditions.

newColumn =
MAXX ( FILTER ( Table, [delivery] = EARLIER ( Table[delivery] ) ), [log date] )

EARLIER vs EARLIEST in DAX - Excelerator BI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.