Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

using if function for current month to return text value

I have status cloumn that has  the status of each rpocess I review on monthly basis. however, since we are in the begining of the year, the status would result to NULL because the relvant processes h...
  • BA_Pete's avatar
    4 years ago

    Hi Anonymous ,

     

    Without seeing an example of your table I can't be sure that what you are trying to do is actually correct, but I think your formula should read like this:

    // Add this as a new CUSTOM COLUMN
    if [Request Status] <> null then [Request Status]
    else if [Request Status] = null and Date.IsInCurrentMonth([#"Month - Date"]) then "Not Submitted"
    else "Not due yet"

     

    You're mixing up functions in your formula by trying to set the value of [Request Status] to your output text.

    The formula above will create a new column containing your desired output.

     

    If you want this to replace values in the [Request Status] column, you will need to use Table.ReplaceValue in a custom step, something like this:

    // Add this as a CUSTOM STEP
    = Table.ReplaceValue(
        previousStepName,
        each [Request Status],
        each if [Request Status] <> null then [Request Status]
        else if [Request Status] = null and Date.IsInCurrentMonth([#"Month - Date"]) then "Not Submitted"
        else "Not due yet",
        Replacer.ReplaceText,{"Request Status"}
    )

     

    Pete