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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
nadirS
Helper I
Helper I

Lookup a Date from a Date Table

I have two tables in Power BI Desktop - One is a date Table (Attached) and another one which has the Start Date and Time for an activity. The completion time for all tasks is 5 days. The date table has a column (Holidays) which gives me 0's for Weekends/Holidays and 1's for Working days. I want to be able to Calculate the 'Proposed Completion Date'.

So Basically taking the SLAStartwithHolidays Date from One table adding 5 days to it and providing the corresponding date from the date table.

For Example if the Date from SLAStartwihHolidays is 01/02/2020 adding 5 days (Sum of 1's from the Holidays Colum) should give me 1/08/2020. 

 

I cannot just add 5 days to the start date becuse that will not take into account work days / holidays. 

 Date Table: 

nadirS_0-1605120564553.png

Data Table has the following Field: 

nadirS_1-1605120635243.png

 

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

Hi, @nadirS 

Try to  create calculated column as below:

Rownumber =
VAR tab =
    FILTER ( ALL ( 'Table' ), 'Table'[Holiday] = 1 )
RETURN
    IF (
        [Holiday] = 1,
        COUNTX ( FILTER ( tab, [Date] <= EARLIER ( 'Table'[Date] ) ), [Holiday] )
    )
Flag = [Rownumber] + 4
Result = 
var _enddate=MAXX(ALL('Table'),'Table'[Date])-5
return
IF (
    'Table'[Holiday] = 1 &&'Table'[Date]<=_enddate,
    LOOKUPVALUE ( 'Table'[Date], 'Table'[Rownumber], 'Table'[Flag], [Date] ),
    BLANK()
)

 The result will show as below:

13.png

 

Please check attached pbbix for more details.

 

Best Regards,
Community Support Team _ Eason
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-easonf-msft
Community Support
Community Support

Hi, @nadirS 

Try to  create calculated column as below:

Rownumber =
VAR tab =
    FILTER ( ALL ( 'Table' ), 'Table'[Holiday] = 1 )
RETURN
    IF (
        [Holiday] = 1,
        COUNTX ( FILTER ( tab, [Date] <= EARLIER ( 'Table'[Date] ) ), [Holiday] )
    )
Flag = [Rownumber] + 4
Result = 
var _enddate=MAXX(ALL('Table'),'Table'[Date])-5
return
IF (
    'Table'[Holiday] = 1 &&'Table'[Date]<=_enddate,
    LOOKUPVALUE ( 'Table'[Date], 'Table'[Rownumber], 'Table'[Flag], [Date] ),
    BLANK()
)

 The result will show as below:

13.png

 

Please check attached pbbix for more details.

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

nadirS
Helper I
Helper I

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.