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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Business Days Age calculation between two dates excluding weekends

Dear Team,

 

i am trying to create a column Business Days Age in power BI (Difference between two dates excluding weekends). below is the table i am referring to.

Note: "Reporting Date" column is created by Formula. finding difficulty in arriving "Network days"

 

tried creating a query as below, but it didn't work as the "Reporting Date" column not appearing in the formula bar. As it is not in the original Data table(it is created by a formula)

 

= (StartDate as date, EndDate as date) as number =>
let
ListDates = List.Dates(StartDate, Number.From(EndDate-StartDate),#duration(1,0,0,0)),
RemoveWeekends = List.Select(ListDates, each Date.DayOfWeek(_, Day.Monday)< 5),
CountDays = List.Count(RemoveWeekends)
in
CountDays

 

Value DateReporting DateBusiness Days Age
6/1/20216/7/20215
5/13/20216/7/202118
6/2/20216/7/20214
6/2/20216/7/20214
6/3/20216/7/20213
6/2/20216/7/20214
5/28/20216/7/20217
6/3/20216/7/20213
6/3/20216/7/20213
6/3/20216/7/20213
6/3/20216/7/20213
6/4/20216/7/20212
6/4/20216/7/20212
6/4/20216/7/20212
6/4/20216/7/20212
6/4/20216/7/20212
6/4/20216/7/20212
6/4/20216/7/20212
6/2/20216/7/20214
5/28/20216/7/20217
6/3/20216/7/20213
6/2/20216/7/20214
5/31/20216/7/20216
5/31/20216/7/20216
6/2/20216/7/20214
6/2/20216/7/20214
6/2/20216/7/20214
6/4/20216/7/20212
6/2/20216/7/20214
6/2/20216/7/20214
6/2/20216/7/20214
6/2/20216/7/20214
1 ACCEPTED SOLUTION
aj1973
Community Champion
Community Champion

@Anonymous 

 

 

  • Add a calendar table to your model, let's call it DimDate
  • Add column to the DimDate, use this formula 

WorkingDay_Mark =

VAR WeekDayNum =

  WEEKDAY ( DimDate[Date] )

RETURN

IF ( WeekDayNum = 1 || WeekDayNum = 7 ,0,1)

 

  • the formula will mark 1 for working days and 0 for weekends
  • to your fact table add column and use this formula

Business Days Age =

COUNTROWS (

           FILTER (

                   DimDate,

                   AND (

                            AND (

                                     DimDate[Date].[Date] >= Orders[Value Date].[Date],

                                     DimDate[Date].[Date] <= Orders[Reporting Date].[Date]

                            ),

                            DimDate[WorkingDay_Mark]

                     )

            )

)

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

View solution in original post

3 REPLIES 3
aj1973
Community Champion
Community Champion

Hi @Anonymous 

Formulas created in the model you can't see them or use them in Power Query.

Use DAX in the model to get the numbers you want.

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Hi Amine,

 

If you can provide the DAX function to calculate the Age excluding weekends it would be helpful.

 

i am new to Power BI and not aware of DAX functions.

 

Regards,

Kiran

aj1973
Community Champion
Community Champion

@Anonymous 

 

 

  • Add a calendar table to your model, let's call it DimDate
  • Add column to the DimDate, use this formula 

WorkingDay_Mark =

VAR WeekDayNum =

  WEEKDAY ( DimDate[Date] )

RETURN

IF ( WeekDayNum = 1 || WeekDayNum = 7 ,0,1)

 

  • the formula will mark 1 for working days and 0 for weekends
  • to your fact table add column and use this formula

Business Days Age =

COUNTROWS (

           FILTER (

                   DimDate,

                   AND (

                            AND (

                                     DimDate[Date].[Date] >= Orders[Value Date].[Date],

                                     DimDate[Date].[Date] <= Orders[Reporting Date].[Date]

                            ),

                            DimDate[WorkingDay_Mark]

                     )

            )

)

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors