João Galdino
João Galdino

Reputation: 95

How to convert this formula from excel to M language?

I'm try convert the formula bellow to Power BI M language

=IF(AC4>TIMEVALUE("20:00:00");"After the deadline";"In the term")

I tried formula bellow but doesn't work, it return this error message "The name 'IF' wasn't recognized. Make sure it's spelled correctly.":

=IF(
TIMEVALUE([#"(Transf1-Coleta)"]) > TIMEVALUE("20:00:00"),
"After the deadline",
"In the term"
)

The column [#"(Transf1-Coleta)"] is the same value of column "AC" and "AD" is the value that want get

enter image description here

Upvotes: 0

Views: 94

Answers (2)

smpa01
smpa01

Reputation: 4346

In M

= Table.AddColumn(#PreviousStep, "Custom", each if DateTime.Time([Transf1-Coleta])>Time.FromText("20:00:00") then "After the Deadline" else"In the term")

Upvotes: 0

mkRabbani
mkRabbani

Reputation: 16908

if you are using Measure, try this below code-

=IF(
    TIMEVALUE(min(table_name[column_name])) > TIMEVALUE("20:00:00"),
    "After the deadline",
    "In the term"
)

Upvotes: 1

Related Questions