Forum Discussion

sarah8991's avatar
sarah8991
Frequent Visitor
3 years ago
Solved

Column with 4 time periods

I have a column that is called "expiry date" with all dates.

 

I want to categorize each row into:

- "3 months"

- "6 months"

- "12 months"

- Blank

 

So, if it's 3 months until expiration from today, it will generate an output of "3 months". And if it's between 3-6 months until expiry, it will be "6 months". And if it's between 6-12 months until expiry, it will be "12 months. And the rest will be blank. 

 

Right now here is my query:

Expiry period =
SWITCH(
TRUE(),
'Table1'[Expiry Date] < TODAY()+DAY(365) && 'Table1'[Expiry Date] > TODAY() +DAY(180),"12 months",
'Table1'[Expiry Date] < TODAY()+DAY(180) && ''Table1'[Expiry Date] > TODAY() +DAY(90),"6 months",
'Table1'[Expiry Date] < TODAY()+DAY(90) && 'Table1'[Expiry Date] > TODAY(),"3 months"
)
 
It's not generating correctly though. Please help!