Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:
Date | Date Status |
7/17/2024 | Current |
7/17/2024 | Current |
6/10/2024 | Previous |
6/10/2024 | Previous |
5/12/2024 | Old/blank |
5/12/2024 | Old/blank |
Solved! Go to Solution.
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")
Regards
Phil
Proud to be a 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")
Regards
Phil
Proud to be a Super User!