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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
PowerBIUser3492
New Member

Creating new Date Column or Measure based on certain values

Hey Everyone, 

I've been racking my brain trying to create a couple new date columns in Power BI based on certain critieria and values. Below you will see my current table:

PowerBIUser3492_0-1676422295617.png

 

 

This is my desired outcome. You will see I am adding two columns - "Original Purchase Date" and "Most Recent Purchase Date."

PowerBIUser3492_1-1676422157101.png

 

I would post my excel file, but this window will not let me attach files... I guess I don't have privileges? And I tried post a table, but I am getting an HTML error. Thank you for your help. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PowerBIUser3492 ,

 

Please try:

Orginal Purchase Date = 
CALCULATE (
    MIN ( 'Table'[Date] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Type] = "Purchase"
            && 'Table'[ID] = EARLIER ( 'Table'[ID] )
    )
)
Most Recent Purchase Date = 
CALCULATE (
    MAX ( 'Table'[Date] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Type] = "Purchase"
            && 'Table'[Date] <= EARLIER ( 'Table'[Date] )
    )
)

vcgaomsft_0-1676512829736.png

 

//I would post my excel file, but this window will not let me attach files...

You can link to a cloud file. Make sure the file doesn't contain any sensitive data before you make it public.

How to provide sample data in the Power BI Forum

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @PowerBIUser3492 ,

 

Please try:

Orginal Purchase Date = 
CALCULATE (
    MIN ( 'Table'[Date] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Type] = "Purchase"
            && 'Table'[ID] = EARLIER ( 'Table'[ID] )
    )
)
Most Recent Purchase Date = 
CALCULATE (
    MAX ( 'Table'[Date] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Type] = "Purchase"
            && 'Table'[Date] <= EARLIER ( 'Table'[Date] )
    )
)

vcgaomsft_0-1676512829736.png

 

//I would post my excel file, but this window will not let me attach files...

You can link to a cloud file. Make sure the file doesn't contain any sensitive data before you make it public.

How to provide sample data in the Power BI Forum

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

FreemanZ
Community Champion
Community Champion

hi @PowerBIUser3492 

try to add two calculated columns like:

OriginalDate =
VAR _table = 
FILTER(
    TableName, 
    TableName[ID]=EARLIER(TableName[ID])
)
RETURN
MINX(_table, [Date])
 
RecentDate =
VAR _table = 
FILTER(
    TableName, 
    TableName[ID]=EARLIER(TableName[ID])
)
RETURN
MAXX(
    FILTER(_table, TableName[Date]<=EARLIER(TableName[Date])
    ),
    [Date]
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.