Forum Discussion
Column to reflect overdue items
- 2 years ago
Hi Anonymous ,
There are many ways to produce your required output by using Power Query and/ or dax. In order to fix the "Today Date", I used the combined methodology of power query and dax as show below.
First, add a custom column in Power Query to fix today's date and rename the column to "Date Today", as you specified.
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.From(DateTime.LocalNow())), #"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"Custom", "Date Today"}})The in Power BI data model table view, write a calculated column like below:
Overdue status = Switch(True(), 'Table'[PLANNING DATE (UTC)]>'Table'[Date Today]&&'Table'[Custom Status]="Open","Overdue", 'Table'[PLANNING DATE (UTC)]<'Table'[Date Today]&&'Table'[Custom Status]="Open","On-Track", 'Table'[PLANNING DATE (UTC)]=blank()&&'Table'[Custom Status]="Open","Unplanned", 'Table'[Custom Status]="Solved","Done")The resultant output is as shown below:
I attach an example pbix file.
Hi Anonymous ,
There are many ways to produce your required output by using Power Query and/ or dax. In order to fix the "Today Date", I used the combined methodology of power query and dax as show below.
First, add a custom column in Power Query to fix today's date and rename the column to "Date Today", as you specified.
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.From(DateTime.LocalNow())),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"Custom", "Date Today"}})
The in Power BI data model table view, write a calculated column like below:
Overdue status = Switch(True(),
'Table'[PLANNING DATE (UTC)]>'Table'[Date Today]&&'Table'[Custom Status]="Open","Overdue",
'Table'[PLANNING DATE (UTC)]<'Table'[Date Today]&&'Table'[Custom Status]="Open","On-Track",
'Table'[PLANNING DATE (UTC)]=blank()&&'Table'[Custom Status]="Open","Unplanned",
'Table'[Custom Status]="Solved","Done")
The resultant output is as shown below:
I attach an example pbix file.