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
char23
Helper II
Helper II

Add column and label date as current, previous, and old/blank

Hello, I have a set of data in one table I am trying to label. I want to add a new column and label each date as Current, Previous, and Old. I would like to do this in power query if possible, but can use dax if easier. I know I can easily distinguish between current and previous using a max formula with dax. But I want to label anything that is not the previous month as old or blank. 

 

Table:

Date
7/17/2024
7/17/2024
6/10/2024
6/10/2024
5/12/2024
5/12/2024

 

 

New column (Date Status) I want to add:

DateDate Status
7/17/2024Current
7/17/2024Current
6/10/2024Previous
6/10/2024Previous
5/12/2024Old/blank
5/12/2024Old/blank

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @char23 

 

You can use this code in PQ:

 

Custom Column

= if Date.IsInCurrentMonth([Date]) then "Current"

else if Date.IsInPreviousMonth([Date]) then "Previous"

else "Old/Blank")

 

 

 

PhilipTreacy_0-1721262348553.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @char23 

 

You can use this code in PQ:

 

Custom Column

= if Date.IsInCurrentMonth([Date]) then "Current"

else if Date.IsInPreviousMonth([Date]) then "Previous"

else "Old/Blank")

 

 

 

PhilipTreacy_0-1721262348553.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.