Hi Team,
So I’ve been rolling the marble around my head for a couple of days trying to figure out a way to use DATEDIFF in a variable so I don’t have to add more columns to one of my data tables. I’m not sure if it can be done this way so I’m reaching out to my peeps to see if you can help or know the answer.
Here’s what I’m trying to do:
- Determine the number of days between TODAY() and Opportunities[Date]
- Filter the response Opportunities that have a date difference GTE 30 and less than 1 Year from today
- Filter this response by a Status
- Color code background of items that meet this criteria
My initial attempt is the code below (requirements where slightly different than described above, because requirements seem to change regularly) but I was trying to modify this code to do the above. However, when I tried to add a VAR using DATEDIFF for opportunities[Date] it doesn’t work.
QA Days =
VAR TodaysDate = TODAY() // I feel like I shouldn’t need this and just use TODAY in VAR OneYr but it didn’t work properly
VAR OneYr = TodaysDate + 365
RETURN
CALCULATE([Total Opportunities],FILTER(opportunities, opportunities[Date] < TODAY() && opportunities[Opportunity Status] IN {0, 1} && opportunities[Other Date] <= OneYr))