Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Ana9726
Contributor II
Contributor II

YTD with Previous YTD

Hello everyone,

I read all discussions on this topic, but I couldn't find solution. I'm trying to get number of customer for YTD and Previous YTD, but it seams like condition doesn't work, everytime I get total Count, like it's ignoring set analysis. Here is my code:

COUNT({<Year={$(vMaxYear)},Date={'<=$(vMaxDate)'}>}distinct CustomerID)

COUNT({<Year={$(vPriorYear)},Date={'<=$(vPriorYearDate)'}>}distinct CustomerID)

It's not double quotes and all date variables are returning correct values, I checked that.

Thankyou for your help!

 

Labels (1)
1 Solution

Accepted Solutions
Ana9726
Contributor II
Contributor II
Author

I converted everything from date to numeric values, it’s not best idea, but it works, it seams that for some reason <= didn’t work for dates. I hope this Idea will help someone 🙂

View solution in original post

4 Replies
Ana9726
Contributor II
Contributor II
Author

I found problem. <= is not working, but i don’t know how else I can say that I want Date which is less than some other Date 🤔🤔

MayilVahanan

Hi @Ana9726 

Can you try like below

COUNT({<Year={$(vMaxYear)},Date={"<=$(=Date(vMaxDate,'YourDateFormat'))"}>}distinct CustomerID)

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Ana9726
Contributor II
Contributor II
Author

It’s not working. When I put just it works perfectly, but when I put <= It only shows zero.

But It says that expresion is okay. This is what I’m getting with expression you wrote:

count({<Year={2012},Date={“<=03-31-2012”}>}distinct CustomerID)

Thank You for your help!!

Ana9726
Contributor II
Contributor II
Author

I converted everything from date to numeric values, it’s not best idea, but it works, it seams that for some reason <= didn’t work for dates. I hope this Idea will help someone 🙂