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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.