Forum Discussion
Business Day Add Using Date Table
Thanks DaFloDo, i'm not sure how to create the RankX table.
Do you think there's a way to use a dateadd function with a condition where the business day flag is 1?
Hi Anonymous,
i added the rank by creating a new calculated table by adding the rank as a new column.
DatesRankedByDay = ADDCOLUMNS(FILTER(All(Dates), Dates[IsBusinessday]=True), "Rank", RANKX( FILTER(All(Dates), Dates[IsBusinessday]=True), Dates[Date],,ASC))
I am sorry, I could not solve the problem without the help of this additional column.
best regards
florian
- Anonymous7 years agoNot applicable
Thanks DaFloDo, can you clarify - should i be creating a new column in the date table with this code, or, should i be choosing 'new table' and then using this code.
When i add this as a new column in the Dim_Date, this is the error i get:
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
When i choose new table the error is this:
"This expression refers to a Column object named 'Dim_Date[DatesRankedByDay]', which has an error."
DatesRankedByDay = ADDCOLUMNS(FILTER(All(Dim_Date), Dim_Date[BusinessDayFlag]= True), "Rank", RANKX( FILTER(All(Dim_Date) , Dim_Date[BusinessDayFlag]= True) , Dim_Date[FullDate],,ASC))
- DaFloDo7 years agoResolver I
hi Anonymous,
this will be a new calculated table. please see the attached file.
to clear things out:
first step is to create the new calculated table ranked by business daysDatesRankedByDay = ADDCOLUMNS(FILTER(All(Dates), Dates[IsBusinessday]=True), "Rank", RANKX( FILTER(All(Dates), Dates[IsBusinessday]=True), Dates[Date],,ASC))
second step was adding a new calculated column to the peviously created table
After 30 Business Days = var currentRank = DatesRankedByDay[Rank] var found = calculate( min(DatesRankedByDay[Date]); All(DatesRankedByDay); DatesRankedByDay[Rank] - currentRank = 30) return found
best regards
florian