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
ChoiJunghoon
Helper III
Helper III

Create new Date Column

 I want to create new column at the "DataTable". 

If the Startdate is in Holiday, I want to create a new column by converting it to the day the holiday ended.

Pdix file 

 

Untitled.png

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@ChoiJunghoon - Perhaps:

 

Applied Holiday =
  VAR __Date = DATE(YEAR([StartTime]),MONTH([StartTime]),DAY([StartTime]))
  VAR __Remark = LOOKUPVALUE('CalendarTable'[Remark],[Date],__Date)
RETURN
  IF(__Remark <> "Holiday",__Date,
    MINX(FILTER('CalendarTable',[Date]>__Date && [Remark] <> "Holiday"),[Date])
  )

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@ChoiJunghoon - Perhaps:

 

Applied Holiday =
  VAR __Date = DATE(YEAR([StartTime]),MONTH([StartTime]),DAY([StartTime]))
  VAR __Remark = LOOKUPVALUE('CalendarTable'[Remark],[Date],__Date)
RETURN
  IF(__Remark <> "Holiday",__Date,
    MINX(FILTER('CalendarTable',[Date]>__Date && [Remark] <> "Holiday"),[Date])
  )

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you So much

Ashish_Mathur
Super User
Super User

Hi,

That download link does not work.


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

so instead of FIRSTNONBLANK() you are looking for "first blank" holiday column value for a given datetime value

 

- Take your datetime value

- convert it to a date

- in the dates table find the MIN(date) that is greater than or equal to the date in step 2 where the holiday column is blank

 

You can do this via Calculate() or Minx()

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.