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.
Hi
Can someone please help.
I would like to write a logic in Power BI stating
If reviewdate is between today and the next 3 years then 1
If reviewdate is between today and the next 6 months then 2
If reviewdate is between today and the next 18 months then 3
all within the same column?
Thank you
Solved! Go to Solution.
hi @matts29 ,
not sure if i fully get you, supposing you have a data table:
reviewdate |
2/7/2024 |
2/8/2024 |
8/8/2024 |
8/9/2024 |
8/8/2025 |
8/9/2025 |
2/8/2027 |
2/9/2027 |
try to add a calculated column like:
Column =
SWITCH(
TRUE(),
data[reviewdate]<=EDATE(TODAY(), 6), 2,
data[reviewdate]<=EDATE(TODAY(), 18), 3,
data[reviewdate]<=EDATE(TODAY(), 36), 1,
0
)
it worked like:
hi @matts29 ,
not sure if i fully get you, supposing you have a data table:
reviewdate |
2/7/2024 |
2/8/2024 |
8/8/2024 |
8/9/2024 |
8/8/2025 |
8/9/2025 |
2/8/2027 |
2/9/2027 |
try to add a calculated column like:
Column =
SWITCH(
TRUE(),
data[reviewdate]<=EDATE(TODAY(), 6), 2,
data[reviewdate]<=EDATE(TODAY(), 18), 3,
data[reviewdate]<=EDATE(TODAY(), 36), 1,
0
)
it worked like:
Thanks thats brilliant! have a good day 🙂
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 |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |