Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Dax to M

Hi, can you help me traslate this to M ? Need a custom column:

 

Train_no_unique = SWITCH(TRUE(),
MONTH(BPS[date])<=11,YEAR(BPS[date])&"_"&BPS[TRAIN_NUMBER],
YEAR(BPS[date])+1&"_"&BPS[TRAIN_NUMBER])

  • I think it would like:

     

    = if Date.Month([date]) <= 11 then Text.From(Date.Year([date])) & "_" & [TRAIN_NUMBER] else Text.From(Date.Year([date] + 1)) & "_" & [TRAIN_NUMBER]

     

    please note that M is case sensitive, so if your column is Date use Date not date.

1 Reply

  • artemus's avatar
    artemus
    Microsoft Employee

    I think it would like:

     

    = if Date.Month([date]) <= 11 then Text.From(Date.Year([date])) & "_" & [TRAIN_NUMBER] else Text.From(Date.Year([date] + 1)) & "_" & [TRAIN_NUMBER]

     

    please note that M is case sensitive, so if your column is Date use Date not date.