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.
Softball question for some of the experts out there...
I have a column titled "Due Date" that tells me when a specific action item will be completed by.
I want to calculate a "Phase" column that returns which Phase of a project that item falls under based on the date.
If the date is 6/30/2020 or earlier, I want the Phase column to say, "Phase 1".
If the date is between 6/30/2020 and 9/30/2020, I want the Phase column to say, "Phase 2".
If the date is between 10/1/20 and 12/31/20, I want the Phase column to say , "Phase 3".
If the date falls after 12/31/20, I want the Phase column to say, "N/A" or something similar.
Solved! Go to Solution.
@tmitton - Seems like:
Phase =
SWITCH(TRUE(),
[Date] <= DATE(2020,6,30),"Phase 1",
[Date] > DATE(2020,6,30) && [Date] <= DATE(2020,9,30),"Phase 2",
[Date] > DATE(2020,10,1) && [Date] <= DATE(2020,12,31),"Phase 3",
"N/A"
)
@tmitton - Seems like:
Phase =
SWITCH(TRUE(),
[Date] <= DATE(2020,6,30),"Phase 1",
[Date] > DATE(2020,6,30) && [Date] <= DATE(2020,9,30),"Phase 2",
[Date] > DATE(2020,10,1) && [Date] <= DATE(2020,12,31),"Phase 3",
"N/A"
)
This returns the following error:
It had me remove one of the double "&" keys, and then told me that "SWTICH" is not recognized.
Thanks again for any guidance you can provide.
@tmitton
You are supposed to use @Greg_Deckler 's solution as a new column in your table in the Power BI Data Model. not in Power Query.
Select the table and
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@tmitton
Make sure your [Date/Time Due] is in Date format. The ERROR msg explains it.
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thank you all!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
68 | |
64 | |
51 | |
39 | |
26 |
User | Count |
---|---|
83 | |
57 | |
45 | |
44 | |
35 |