The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi All ,
I need some inputs regarding adding a new field "Status" . I have start date and End Date .
The logic Is , if current date is between startdate and End date then the status is "Active" else "Inactive"
Im using this
= Table.AddColumn(tablename, "Status", each if [Start_Date] <= Date.From(DateTime.LocalNow()) then "Active" else if [End_Date] >= Date.From(DateTime.LocalNow()) then "Active" else "Inactive")
TIA!
Solved! Go to Solution.
Sorry, I have updated the script to use your table name.
Table.AddColumn(tablename, "Status", each let today = Date.From ( DateTime.FixedLocalNow() ) in if [Start_Date] <= today and [End_Date] >= today then "Active" else "Inactive", type text)
If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User
Sorry, I have updated the script to use your table name.
Table.AddColumn(tablename, "Status", each let today = Date.From ( DateTime.FixedLocalNow() ) in if [Start_Date] <= today and [End_Date] >= today then "Active" else "Inactive", type text)
If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User
Hello! Here you go:
Table.AddColumn(#"Changed Type", "Status", each let today = Date.From ( DateTime.FixedLocalNow() ) in if [StartDate] <= today and [EndDate] >= today then "Active" else "Inactive", type text)
If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User
@jennratten Thanks for replying . Im getting this
"The name 'Changed Type' wasn't recognized. Make sure it's spelled correctly."
Im new to powerQuery . Any idea what im missing ?