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
PBI_newuser
Post Prodigy
Post Prodigy

Power Query: how to create missing date

Hi,

I want to fill in the missing [Assigned Date].

 

How to create the [Assigned Date] with the below criteria:

 

If there is no [Assigned Date], then use [Created Date],

but if the [Created Date] is after [Onsite Date],

then use [Onsite Date] as [Assigned Date].

 

Assigned DateCreated DateOnsite Date
2/27/20202/26/202010/13/2020
-9/2/20209/8/2020
-9/12/20209/5/2020
1 ACCEPTED SOLUTION

Hi @PBI_newuser ,

 

May be modify the condition as follows and the try:

NewCol = IF([Assigned Date] = BLANK() && [Created Date] < [Onsite Date], [Created Date],

IF([Assigned Date] = BLANK() && [Created Date] > [Onsite Date], [Onsite Date],  [Assigned Date]))

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

You can do this in DAX by creating a new table with all of the dates in your range as follows: FullTable = ADDCOLUMNS( CALENDAR(MIN(Table1[Date]), MAX(Table1[Date])), "Quantity", LOOKUPVALUE( Table1[Quantity], Table1[Date], MAXX( FILTER(Table1, Table1[Date] <= EARLIER([Date])), [Date] ) ) )

 

The CALENDAR function gives you a range of dates from you minimum to maximum dates in your original table. From there, we add a new column, Quantity, and define it as the value we get when looking up the Quantity in the original table for the date that was the maximum date occurring on or before the date in the current row.

Pragati11
Super User
Super User

Hi @PBI_newuser ,

 

You can create a calculated column using the DAX below:

NewCol = IF([Assigned Date] = BLANK(), [Created Date], IF([Created Date] > [Onsite Date], [Onsite Date],  [Assigned Date]))

 

Just make sure all the columns are in DATE format.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi @Pragati11 ,

It doesn't work. 

PBI_newuser_0-1603891106747.png

 

Hi @PBI_newuser ,

 

May be modify the condition as follows and the try:

NewCol = IF([Assigned Date] = BLANK() && [Created Date] < [Onsite Date], [Created Date],

IF([Assigned Date] = BLANK() && [Created Date] > [Onsite Date], [Onsite Date],  [Assigned Date]))

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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.