Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
dd
Solved! Go to Solution.
@az38 I got it to work using this:
@Anonymous , not very clear where you want to use that. But check a couple of options
if(max(allopps-products[status])="open",
SWITCH(
TRUE(),
MAX('AllOpps-Products'[Prob.]) = 80, "30 Days",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 90, "Older than 90",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 60, "Older than 60",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 30, "Older than 30",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 15, "30 Days",
FALSE
),blank())
SWITCH(
TRUE(),
MAX('AllOpps-Products'[Prob.]) = 80 && max(allopps-products[status])="open", "30 Days",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 90, "Older than 90",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 60, "Older than 60",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 30, "Older than 30",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 15, "30 Days",
FALSE
)
@amitchandak (or anyone that can answer)
The solution from Amit is great, with one exception.
How to deal with a date that is in the past? Example:
The estimated close date may indeed be 15 days or more from today's date....but it could be 15 days in the past from today (not 15 days FROM today). For those estimated close dates that have passed already (from today's current date), how to address in the Switch statement?
Hi @Anonymous
smth like
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 0, "0 Days",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> -15, "Passed already",
Thanks AZ. @az38 But I am getting some strange results. May 29 is two days away, but it is shows "pass already" as a result. The table on the left using the formula. The table on the right is a list of opportunities and their estimated close/ship date.
@Anonymous
it will work only if you previously add row with 0 value comparision as in my example
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 0, "0 Days",
@az38 I got it to work using this:
@az38 Hi AZ - Yes, if you are talking about including it in the measure you created, it is there, but that is the result I am getting.
Here is another example. This time in June. It is showing that this opportunity's estimate ship date has "passed already" but it still about 20 days into the future.
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
92 | |
83 | |
71 | |
49 |
User | Count |
---|---|
143 | |
120 | |
110 | |
59 | |
57 |