Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
hansrokers
Contributor III
Contributor III

'and' in set analysis

Hello,

I am strugling with the following:

I need need the sales of last year, lower then the max week and lower then the current week.

Something like:

sum({$ <Year={$(=max(Year)-1)},Week = {"<$(=week(Today()))"} and Week = {"<$(=max(Week))"}  >} Sales )

but this does not work.

Any suggestions?

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=sum({$ <Year={$(=max(Year)-1)}, Week = {"<$(=week(Today()))"} * {"<$(=max(Week))"}  >} Sales )

Hope this helps you.

Regards,

Jagan.

View solution in original post

9 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Try this, "and" is replaced by comma ....

sum({$ <Year={$(=max(Year)-1)},Week = {"<$(=week(Today()))","<$(=max(Week))"}  >} Sales )

hope it helps

hansrokers
Contributor III
Contributor III
Author

This wil give me the total sales of last year as no week has been selected

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this,

     sum({$ <Year={$(=max(Year)-1)},Week = {"<$(=week(Today()))<$(=max(Week))"}  >} Sales )

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
alexandros17
Partner - Champion III
Partner - Champion III

At this point try to use a workaround (I don't know how your data are organized):

With a variable compute max between max(week) and week(today()) then use that only variable in set analysis

hansrokers
Contributor III
Contributor III
Author

This results in 0.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Its because you may be be having the relevant data.

     Kindly upload your QVW file.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
hansrokers
Contributor III
Contributor III
Author

I have been able to solve the problem with an if-statement, but I am sure there must be a better solution:

if(GetSelectedCount(Week)>0, sum({$ <Year={$(=max(Year)-1)},Week = {"<=$(=max(Week))"} >} Sales),sum({$ <Year={$(=max(Year)-1)},Week = {"<=$(=week(today()))"} >} Sales))

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     You can replace this using below expression.

     sum({$ <Year={$(=max(Year)-1)},Week = {"<=$(=if(GetSelectedCount(Week)>0,max(Week),week(today())))"} >} Sales)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=sum({$ <Year={$(=max(Year)-1)}, Week = {"<$(=week(Today()))"} * {"<$(=max(Week))"}  >} Sales )

Hope this helps you.

Regards,

Jagan.