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

Grab the smallest date from today

 Today's date1/15/20  
     
IdDate ADate B New Column
1231/1/201/4/20 1/1/20
123311/2/201/29/20 1/2/20
12353null2/23/20 1/29/20
123123null3/19/20 1/29/20
45641/10/204/13/20 1/10/20
5464null5/8/20 1/29/20
4564562/1/206/2/20 2/1/20
45645null6/27/20 1/29/20

 

Hi, I need to create a new column which will use the date from Date A column and if it is null then grab the smallest date from Date B which is greater that today's today

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

Hi @newkingdom @amitchandak 

There is a mistake in the formula of amitchandak provided. 

It just needs a little modification as below:

if(isblank(table[column B]),(minx(filter(table,table[column B] >Today()),table[column B])),table[column A])

if(isblank(table[column A]),(minx(filter(table,table[column B] >Today()),table[column B])),table[column A])

 

or use this formula:

IF (
    ISBLANK ( 'table'[Date A] ),
    CALCULATE ( MIN ( 'table'[Date B] ), FILTER ( 'table', 'table'[Date B] >= TODAY () )),
    'table'[Date A]
)

 

Regards,

Lin

Community Support Team _ Lin
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

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

Hi @newkingdom @amitchandak 

There is a mistake in the formula of amitchandak provided. 

It just needs a little modification as below:

if(isblank(table[column B]),(minx(filter(table,table[column B] >Today()),table[column B])),table[column A])

if(isblank(table[column A]),(minx(filter(table,table[column B] >Today()),table[column B])),table[column A])

 

or use this formula:

IF (
    ISBLANK ( 'table'[Date A] ),
    CALCULATE ( MIN ( 'table'[Date B] ), FILTER ( 'table', 'table'[Date B] >= TODAY () )),
    'table'[Date A]
)

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

Create it as a new column

if(isblank(table[column B]),(minx(filter(table,table[column B] >Today()),table[column B])),table[column A])

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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.