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
This is follow up to my previous post
I have the expiration date column as below
I calculated no of days from the expiration column using the below measures
No of days = DATEDIFF( 'Expiration Days'[Current Expiration Date],TODAY(), DAY)
I want to calculate a new column called status with the following condition,
If no of days is within 60 days then I need to create "Expired within 60 days"
If no of the day's Will Expire < 1 Week from Today's date then I need to create “In 1 Week”
If no of the day's Will Expire < 2 Weeks from Today's date then I need to create “In 2 Weeks”
I used the below dax measure
Status =
IF('Expiration Days'[No of days] > 0 && 'Expiration Days'[No of days] =60, "Expired within 60 days",
IF( 'Expiration Days'[No of days] <= 0 && 'Expiration Days'[No of days] <= -7, "Expire in 1 week",
IF( 'Expiration Days'[No of days] <= -7 && 'Expiration Days'[No of days] <= -14, "Expire in 2 weeks", "No"))
Negative values condition is not working, I am getting below
Can anyone advise? People in the previous posts helped me to rectify it, however, it's not working.
Solved! Go to Solution.
Hi @bourne2000. I would do it something like this:
Status =
VAR NumDays = [No of days]
VAR Result =
SWITCH(
TRUE(),
NumDays <= -14, "Expire in 2 weeks",
NumDays <= -7, "Expire in 1 week",
NumDays >= 0 && NumDays <= 60, "Expired within 60 days",
"No"
)
RETURN Result
Hi @bourne2000. I would do it something like this:
Status =
VAR NumDays = [No of days]
VAR Result =
SWITCH(
TRUE(),
NumDays <= -14, "Expire in 2 weeks",
NumDays <= -7, "Expire in 1 week",
NumDays >= 0 && NumDays <= 60, "Expired within 60 days",
"No"
)
RETURN Result
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
75 | |
71 | |
38 | |
29 | |
26 |
User | Count |
---|---|
97 | |
96 | |
60 | |
44 | |
41 |