Forum Discussion
Need Help in finding Due date
- 4 years ago
Hi Anonymous
Here is the sample file with the solution for both a calculated column and a measure https://we.tl/t-jwOgrzLuxMFor calculated column please use
Due Date = VAR CurrentDate = Tickets[Ticket St date] VAR T1 = CALENDAR ( CurrentDate, CurrentDate + 15 ) VAR T2 = FILTER ( T1, NOT ( WEEKDAY ( [Date] ) IN { 6, 7 } ) && NOT ( [Date] IN VALUES ( 'Australia holidays'[Date] ) ) ) VAR T3 = TOPN ( 10, T2, [Date], ASC ) RETURN MAXX ( T3, [Date] )Due Date Measure = VAR CurrentDate = SELECTEDVALUE ( Calendar_Table[Date] ) RETURN IF ( NOT ISBLANK ( CurrentDate ), VAR T1 = CALENDAR ( CurrentDate, CurrentDate + 15 ) VAR T2 = FILTER ( T1, NOT ( WEEKDAY ( [Date] ) IN { 6, 7 } ) && NOT ( [Date] IN VALUES ( 'Australia holidays'[Date] ) ) ) VAR T3 = TOPN ( 10, T2, [Date], ASC ) RETURN MAXX ( T3, [Date] ) )
Hi,
I am not sure how your data model looks like, but please check the below picture and the attached pbix file.
It is for creating a new column without having a physical dim-calendar table. If you have one, please use your dim-calendar table.
10 working days later CC =
VAR _calendartable =
FILTER (
ADDCOLUMNS (
CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2022, 12, 31 ) ),
"@weekdayname", FORMAT ( [Date], "DDDD" )
),
[@weekdayname] <> "Saturday"
&& [@weekdayname] <> "Sunday"
)
VAR _addticketreceiveddate =
CROSSJOIN ( _calendartable, Data )
VAR _adddayscount =
FILTER (
ADDCOLUMNS (
_addticketreceiveddate,
"@dayscount",
COUNTROWS (
FILTER (
_calendartable,
[Date] >= Data[TicketReceived]
&& [Date] <= EARLIER ( [Date] )
)
)
),
[@dayscount] = 10
)
RETURN
MAXX (
FILTER (
_adddayscount,
Data[TicketReceived] = EARLIER ( Data[TicketReceived] )
),
[Date]
)
- Anonymous4 years agoNot applicable
Hello Jihwan,
I was trying in my data but still getting an incorrect result.
I am attaching my file for your reference. This is my Date table
This is my Ticket table
- Jihwan_Kim4 years ago
Super User
Hi,
Thank you for your feedback.
Please share your sample pbix file's link here, and then I can try to come up with more accurate solution for your data model.
Thanks.
- Anonymous4 years agoNot applicable
Hi
I tried to upload my pbix file but i am not getting option to load the file. May be i am not allowed