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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kasife
Helper V
Helper V

comparison between columns

Guys,

in the M language, how could I get just the month and year of each column so that I can perform a comparison?

For exemplo: 

   (Column data_alteracao_status)         (CreatedDate)

if               11/2022                          <    10/2022    then null 

I would like to compare month and year only, without full date

kasife_1-1682644878503.png

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

in case of no less I wrote "OK". instead you can paste what you want

if
Number.From(Date.ToText(
Date.From([data_alteracao_status]),[Format= "yyyyMM"])) <
Number.From(Date.ToText(
Date.From([CreatedDate]),[Format= "yyyyMM"])) then null else "OK"

Screen Capture #971.png

View solution in original post

2 REPLIES 2
kasife
Helper V
Helper V

@Ahmedx  than you so much

Ahmedx
Super User
Super User

in case of no less I wrote "OK". instead you can paste what you want

if
Number.From(Date.ToText(
Date.From([data_alteracao_status]),[Format= "yyyyMM"])) <
Number.From(Date.ToText(
Date.From([CreatedDate]),[Format= "yyyyMM"])) then null else "OK"

Screen Capture #971.png

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.