Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone
I have a slider that is set up to act as a period selector.
Min value and max value are defined as follows
'=date#(min({1} date_YYYYMM),'YYYYMM')'
'=date#(max({1} date_YYYYMM),'YYYYMM')'
I use these periods in my set analysis, for example:
Count({$<[order_date_YYYYMM]={">=$(=min(date($(vPeriod3),'YYYYMM')))<=$(=max(date($(vPeriod4),'YYYYMM')))"} ,$(vExp_Unselect_datefields), $(vExternalClients),$(vOnlyBOWithKnownLT),$(vExcludingArticleTypes)>} so_ordernumber)
Now I face 2 problems:
1. When sliding up & down my 12 month selection seems to have 12 or 13 months. Probably the period is somewhere between 12 and 13 months, where I would like to have exactly 12. I thought that having static step would prevent this.
2. My variable vPeriod3/4 often becomes a value with digits for example 42890,4. This causes my calculations to be wrong.
A value of 42890,4 means that you haven't a date else it's a timestamp. You could with:
date(floor([order_date_YYYYMM])) as [order_date_YYYYMM]
transform your timestamp into a date. And quite probably I would do it directly within the script and not just within the mentioned variables/expressions.
- Marcus
These are all dates, no time stamps.
Thanks for your help!
To see a date doesn't mean mandatory that it is really a date - it could be just formatted. And 42890,4 is definitely a timestamp - just use in a textbox: timestamp(42890.4) to see the result.
- Marcus
Indeed but there is no formatting set to date. In fact if the choice is made to display decimals, it will display ,00. Also the source data is only a date, no time-stamp.
How are your variables vPeriod3/4 created?
Well they are dynamic, since the user can drag the slider and thereby changing the variables.
I think your min/max isn't like you expected it - just try them within a textbox:
=date#(min({1} date_YYYYMM),'YYYYMM')'
=date#(max({1} date_YYYYMM),'YYYYMM')'
and think it should be rather like:
floor(min({1} date_YYYYMM)) // maybe without a formatting
- Marcus
Both formulas will give me 201501 or 201712 respectively as expected. These variables are used to define the start and end of the slider. The problem is the bar that defines the periods.
Thanks for your perseverance
What returned min/max({1} date_YYYYMM) within a textbox by different selections? Always an integer?