Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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])

1 ACCEPTED SOLUTION
artemus
Microsoft Employee
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.

View solution in original post

1 REPLY 1
artemus
Microsoft Employee
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.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors