Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm using set analysis to get the number of sold items for a specific week (this week).
I'm using
sum({$ <YEAR = {"=year(today())"}, WEEK = {"=week(today())"}>}Sold)
What I get is the sum for all weeks this year.
I suspect the reason is that week(today()) returns 8 and in my table it is stored as 08.
So I was thinking I could solve it using
sum({$ <YEAR = {"=year(today())"}, WEEK = {"=If(len(num(week(today())))=1, 0&num(week(today())), num(week(today())))"}>}Sold)
But this gives the same result i.e. the sum for all weeks this year.
Are you not allowed to use If in set analysis?
Is the another way of solving this?
br
Martin
if you need to set week to 2 digits use num(week(today()), '00')
Week returns an integer, so thats not the problem
Try like this:
sum({$ <YEAR = {"$(=year(today()))"}, WEEK = {"$(=week(today()))"}>}Sold)
I have used this in a load script but it shoudl work in expression as well. I basically used Right('00' & Week,2) and that then pads out single digits to two and leaves two as were but due to the Right command converts it to text
if you need to set week to 2 digits use num(week(today()), '00')