Forum Discussion
Syndicate_Admin
4 years agoAdministrator
Help with Absence Data Status
I am new to Power Query and starting to see the benefits of using it. I have a a data issue that I have tried to research using YouTube and forums but to no avail and I hope someone here can assist ...
- 4 years ago
Use below Query where ReportMonth is a parameter to store your reporting month.
Solution Excel uploaded to https://1drv.ms/x/s!Akd5y6ruJhvhuUUKb3_p1vZ7Cp5C?e=eHE291
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Personnel Number", type text}, {"Absence Start Date", type date}, {"Absence End Date", type date}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Status", each if [Absence End Date]=Date.EndOfMonth(#date(Date.Year([Absence End Date]),ReportMonth,1)) or (Date.Month([Absence Start Date])<>ReportMonth and Date.Month([Absence End Date])<>ReportMonth) then "All Month" else if Date.Month([Absence Start Date])=ReportMonth then "Commenced" else if [Absence End Date]<=Date.AddDays(Date.EndOfMonth(#date(Date.Year([Absence End Date]),ReportMonth,1)),-1) and [Absence End Date]>=#date(Date.Year([Absence End Date]),ReportMonth,1) then "Returned" else null) in #"Added Custom"
Syndicate_Admin
4 years agoAdministrator
Thank you so much Vijay, this worked perfectly, apologies for the delay in confirming that it had.