Forum Discussion
Showing latest date before specific date
- 3 years ago
Thank you for sample data. Here is the code:
Customers with last ticket older than 2 weeks ago = var customer_last_ticket = MAXX( DISTINCT('Sample'[client_id]); MAX('Sample'[created_at]) ) return IF(DATEDIFF(customer_last_ticket;TODAY();DAY)>=14;customer_last_ticket)In the variable customer_last_ticket we are storing an information about last ticket per customer
Then if this ticket is older than 14 days ago we are displaying int 🙂
I hope that this is what you've wanted.
Thank you for sample data. Here is the code:
Customers with last ticket older than 2 weeks ago =
var customer_last_ticket =
MAXX(
DISTINCT('Sample'[client_id]);
MAX('Sample'[created_at])
)
return IF(DATEDIFF(customer_last_ticket;TODAY();DAY)>=14;customer_last_ticket)In the variable customer_last_ticket we are storing an information about last ticket per customer
Then if this ticket is older than 14 days ago we are displaying int 🙂
I hope that this is what you've wanted.
Just tried this again and still no luck sadly! I am glad to see it works for you with the test date bellow is a screenshot of what I have done with DB names covered:
I have client_id set as a whole number and created_at set as date time, does this reflect your structure within the test data?
The data is being pulled in from SQL on my end.
- bolfri3 years ago
Solution Sage
I don't think so. Can you paste here an example data rows for customer 0?
- Anonymous3 years agoNot applicable
Sorry, it's just another client number so the data would be roughly the same as the test data supplied.
Tried to attach a test file but cannot link any more.
Are you developing this as a measure or column?
- bolfri3 years ago
Solution Sage
This code that I've send you is a measure.