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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ohnothimagain
Helper I
Helper I

[WORKDAY] How to get the date moved forward [LT]column days

Hello everyone,
now I'm struggling with a problem related WORKDAY...
I want to get the date that move [M_date] forward  [LT] days on workdays.
    →it's equal to Excel function WORKDAY([M_date,-[LT],[Holi]) but I couldn't figure out....(I'm doing it on PowerPivot)

e.g. (Left below; fact table,a row colored yellow  Right; calender table)
M_date is 19/8/2024,LT is 2days,the date wanted is 8/8/2024.

ohnothimagain_0-1722689803948.png

How can I make a formula for calculated column (and measure,if possible)?


Thank you for your continuing support and kindness!
Best Regards,



1 ACCEPTED SOLUTION

@ohnothimagain 

Though I wont recommend calculated columns, here is forumula:

 

var Holiday=filter('Calendar', 'Calendar' [Date]<current _date&&'Calendar'[1* E]='*')

var LT = TEST_'(PN] var F_Date=topn(LT,Holiday, 'Calendar'[Date], DESC)

var Result=minx(F_Date, 'Calendar [Date])

return Result

 

topn is used on a calendar dimension table, so I dont it would cause any performance issues

 

 

Need a Power BI Consultation? Hire me on Upwork

 

Connect on LinkedIn

 




Did I answer your question? Mark my post as a solution!
If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!

PBI_SuperUser_Rank@2x.png

 

View solution in original post

4 REPLIES 4
tharunkumarRTK
Super User
Super User

 @ohnothimagain
There are multiple ways to acheive this, one option is to use NETWORKDAYS function in DAX.
NETWORKDAYS – DAX Guide

 

I tried a different approach and did not use networkdays()

Screenshot 2024-08-03 at 7.49.42 PM.png

Please find the attached file

 

 

Need a Power BI Consultation? Hire me on Upwork

 

Connect on LinkedIn

 




Did I answer your question? Mark my post as a solution!
If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!

PBI_SuperUser_Rank@2x.png

 

Thank you so much! it worked,I have no idea for using TOPN.
and I'm afraid to say that I ask you an additional request,how do you write a formula
for calculated columns?

I tried following formula and it seems to be successed.but I'm concerning its processing cost.
 *sorry for incovenience for displaying in my native language.

ohnothimagain_0-1722734162877.png

 


 

@ohnothimagain 

Though I wont recommend calculated columns, here is forumula:

 

var Holiday=filter('Calendar', 'Calendar' [Date]<current _date&&'Calendar'[1* E]='*')

var LT = TEST_'(PN] var F_Date=topn(LT,Holiday, 'Calendar'[Date], DESC)

var Result=minx(F_Date, 'Calendar [Date])

return Result

 

topn is used on a calendar dimension table, so I dont it would cause any performance issues

 

 

Need a Power BI Consultation? Hire me on Upwork

 

Connect on LinkedIn

 




Did I answer your question? Mark my post as a solution!
If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!

PBI_SuperUser_Rank@2x.png

 

Ah,I've misunderstood about row context...Did it!
I need a numeric table lke this,so I considered it's necessary to make a relationship.
(if there's another way,I’d greatly appreciate it )

ohnothimagain_0-1722750782905.png

anyway,Thank you for your help!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.