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.
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 Date | Reporting Date | Business Days Age |
6/1/2021 | 6/7/2021 | 5 |
5/13/2021 | 6/7/2021 | 18 |
6/2/2021 | 6/7/2021 | 4 |
6/2/2021 | 6/7/2021 | 4 |
6/3/2021 | 6/7/2021 | 3 |
6/2/2021 | 6/7/2021 | 4 |
5/28/2021 | 6/7/2021 | 7 |
6/3/2021 | 6/7/2021 | 3 |
6/3/2021 | 6/7/2021 | 3 |
6/3/2021 | 6/7/2021 | 3 |
6/3/2021 | 6/7/2021 | 3 |
6/4/2021 | 6/7/2021 | 2 |
6/4/2021 | 6/7/2021 | 2 |
6/4/2021 | 6/7/2021 | 2 |
6/4/2021 | 6/7/2021 | 2 |
6/4/2021 | 6/7/2021 | 2 |
6/4/2021 | 6/7/2021 | 2 |
6/4/2021 | 6/7/2021 | 2 |
6/2/2021 | 6/7/2021 | 4 |
5/28/2021 | 6/7/2021 | 7 |
6/3/2021 | 6/7/2021 | 3 |
6/2/2021 | 6/7/2021 | 4 |
5/31/2021 | 6/7/2021 | 6 |
5/31/2021 | 6/7/2021 | 6 |
6/2/2021 | 6/7/2021 | 4 |
6/2/2021 | 6/7/2021 | 4 |
6/2/2021 | 6/7/2021 | 4 |
6/4/2021 | 6/7/2021 | 2 |
6/2/2021 | 6/7/2021 | 4 |
6/2/2021 | 6/7/2021 | 4 |
6/2/2021 | 6/7/2021 | 4 |
6/2/2021 | 6/7/2021 | 4 |
Solved! Go to Solution.
@Anonymous
WorkingDay_Mark =
VAR WeekDayNum =
WEEKDAY ( DimDate[Date] )
RETURN
IF ( WeekDayNum = 1 || WeekDayNum = 7 ,0,1)
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
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
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
@Anonymous
WorkingDay_Mark =
VAR WeekDayNum =
WEEKDAY ( DimDate[Date] )
RETURN
IF ( WeekDayNum = 1 || WeekDayNum = 7 ,0,1)
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
116 | |
105 | |
69 | |
67 | |
43 |
User | Count |
---|---|
148 | |
103 | |
103 | |
88 | |
66 |