Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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 ?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
27 | |
26 | |
21 | |
12 | |
10 |
User | Count |
---|---|
27 | |
25 | |
22 | |
17 | |
13 |