Forum Discussion
Add working days to a submitted date
- 5 years ago
deek2123 watch the video provided by mahoneypat or use the following expression to add a column that I used many times to achieve something similar, in this expression, we are calculating x number of days after the order date to get the ship date, you can replace the table and column name as per you model. The only thing is required is to have a "working day" flag in your date dimension.
Shipping Date = VAR __numberofDays = 10 VAR __orderDate = Orders[Order Date] VAR __dateTable = CALCULATETABLE ( VALUES ( 'Dim Date Table'[Date] ), 'Dim Date Table'[Is Working Day] = 1, 'Dim Date Table'[Date] >= __orderDate ) VAR __dateTableWithRank = ADDCOLUMNS ( __dateTable, "@Rank", RANKX ( __dateTable, [Date], , ASC, Dense ) ) RETURN MAXX ( FILTER ( __dateTableWithRank, [@Rank] = __numberofDays + 1 ), [Date] )Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
deek2123 watch the video provided by mahoneypat or use the following expression to add a column that I used many times to achieve something similar, in this expression, we are calculating x number of days after the order date to get the ship date, you can replace the table and column name as per you model. The only thing is required is to have a "working day" flag in your date dimension.
Shipping Date =
VAR __numberofDays = 10
VAR __orderDate = Orders[Order Date]
VAR __dateTable =
CALCULATETABLE (
VALUES ( 'Dim Date Table'[Date] ),
'Dim Date Table'[Is Working Day] = 1,
'Dim Date Table'[Date] >= __orderDate
)
VAR __dateTableWithRank =
ADDCOLUMNS (
__dateTable,
"@Rank", RANKX ( __dateTable, [Date], , ASC, Dense )
)
RETURN
MAXX (
FILTER (
__dateTableWithRank,
[@Rank] = __numberofDays + 1
),
[Date]
)
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- deek21235 years agoNew Member
This worked perfectly. Thanks!