Forum Discussion
Add working days to a date
- 9 years ago
Hi huguest,
After research and test, there is no a function used to achieve same requirement in Power BI. You can follow the following to solutions.
1.You can calculated them in Excel, then load the data to PowerBI.
2. Create a Canlendar table. The start_date is your min(facttable[date]), and end_date your max(facttable[date]).
CALENDAR(<start_date>, <end_date>)
In Calendar table, create calculated column to display the day if it is work day, rank all working days, get the result based on calculated columns. For example, I add futher 10 working days.Identify = IF(OR(WEEKDAY(Canlendar[Date])=1, WEEKDAY(Canlendar[Date].[Date])=7),0,1) Rank1 = RANKX(FILTER(Canlendar,Canlendar[Identify]=1),Canlendar[Date],,ASC) Add 10 woring days = LOOKUPVALUE(Canlendar[Date],Canlendar[Identify],1,Canlendar[Rank1],Canlendar[Rank1]+10)
Create a relationship batween Calendar and your fact table. Use the related function to get the result in fact table.
Result=RELATED(Calendar[Add 10 woring days])
If you have other issues, please feel free to ask.
Best Regards,
Angelia
Hi huguest,
After research and test, there is no a function used to achieve same requirement in Power BI. You can follow the following to solutions.
1.You can calculated them in Excel, then load the data to PowerBI.
2. Create a Canlendar table. The start_date is your min(facttable[date]), and end_date your max(facttable[date]).
CALENDAR(<start_date>, <end_date>)
In Calendar table, create calculated column to display the day if it is work day, rank all working days, get the result based on calculated columns. For example, I add futher 10 working days.
Identify = IF(OR(WEEKDAY(Canlendar[Date])=1, WEEKDAY(Canlendar[Date].[Date])=7),0,1) Rank1 = RANKX(FILTER(Canlendar,Canlendar[Identify]=1),Canlendar[Date],,ASC) Add 10 woring days = LOOKUPVALUE(Canlendar[Date],Canlendar[Identify],1,Canlendar[Rank1],Canlendar[Rank1]+10)
Create a relationship batween Calendar and your fact table. Use the related function to get the result in fact table.
Result=RELATED(Calendar[Add 10 woring days])
If you have other issues, please feel free to ask.
Best Regards,
Angelia
I know this is a bit of a dated post but when I used the above formulas I am getting blanks for "add working days"