
Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Friedrich Hofmann Mar 14, 2014 3:10 AM (in response to Anton sineok)Hi,
in that case, when you do NOT have any sales_data for a specific week last year  will there be a 0 or just nothing?
=> Depending on that, you have to build your query.
With set_analysis, it's actually not that hard.
Best regards,
DataNibbler

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Anton sineok Mar 14, 2014 3:15 AM (in response to Friedrich Hofmann)(I do not speak in English, and could not quite understand). In the table, if there are no sales (Summ) then there is no record on the week against.
Probably using set_analysis it is not difficult to do but I can not for several days of heavy ..

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Friedrich Hofmann Mar 14, 2014 3:18 AM (in response to Friedrich Hofmann)
Hi,just tried it out:
=> In this case, a simple IF()_construct should be sufficient:
=> Change your formula for 2014 to
>>> IF(SUM ({<year={'2013'}>} Summ) <> 0, SUM ({<year={'2014'}>} Summ)) <<<==>> That way, your sales_data for 2014 will only be displayed in case the sales_data for 2013 is <>0.
HTH
Best regards,
DataNibbler

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Anton sineok Mar 14, 2014 3:33 AM (in response to Friedrich Hofmann)RestNum IF(SUM ({<year={'2013'}>} Summ) > 0, SUM ({<year={'2014'}>} Summ)) 2013 2014 55980 149 113 125 871 149 113 56284 82 243 229 575 82 243 56525 105 941 236 492 105 941 59045  0 38 485 60385  0 77 555 453 337 591 938 453 337 Thank you. These really are not displayed if in 2013 there were no sales! But the amount is still considered full. And should that be not considered. Help please! ..

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Fabrice Aunez Mar 14, 2014 4:17 AM (in response to Anton sineok)Ahtoh,
The result for each RestNum seems to be correct.
* If you have 0 in 2013, you get a Null() result: the dash: 
* If you have a result > 0, you have the 2014 data
The aggregation is not correct because you get the 2014 sum.
Try to do : sum(aggr(YourCurrentExpressionWithTheIF, RestNum))
Fabrice

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Anton sineok Mar 14, 2014 4:33 AM (in response to Fabrice Aunez)I feel that you are right! But with such a formula he believes all the data again. I do not understand ..: (


Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Anton sineok Mar 14, 2014 4:49 AM (in response to Fabrice Aunez)I have no words as you will be grateful!

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Fabrice Aunez Mar 14, 2014 4:55 AM (in response to Anton sineok)Ahtoh,
On a db of mine, I have done that:
sum({<Customer={"=sum({<Month={3}>} Amount)>0"}>} Amount)
I get only the customers where the Amount for the 3d month > 0. I have a good total. There is a set (sum > 0) into a set (on customer that I want to limit).
For you, if I transpose to your db, try sth like:
sum({<RestNum={"=sum({<Year={2013}>}, Summ) > 0"}>} Summ)
Fabrice

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Anton sineok Mar 14, 2014 5:04 AM (in response to Fabrice Aunez)week 1 1 1 RestNum sum({<RestNum={"=sum({<Year={2013}>}, Summ) > 0"}>} Summ)
2013 2014 55980 0 125 871 149 113 56284 0 229 575 82 243 56525 0 236 492 105 941 59045 0 0 38 485 60385 0 0 77 555 0 591 938 453 337 I now have shows all zeros .. (I can not ask you but if still possible  attach file structure in the first message  it can accurately check all)

Re: Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Fabrice Aunez Mar 14, 2014 5:27 AM (in response to Anton sineok)It is not possible because I have the Personal Edition (I would ahve attached it and done the test with your data)
Sorry for that
Picture 1
A pivot table with the corresponding syntax
A pivot table with Sum(Amount) to show the stucture
Picture 2
The first pivot table, I have added Sum(Amount) to show that the syntax returns 0 in that case
I cannot attach your qvw, you will be able to attach mine. That is the last sheet.
Fabrice

110062_1.JPG 27.6 K

110062_2.JPG 43.0 K

110062.qvw 169.2 K

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Anton sineok Mar 14, 2014 9:29 AM (in response to Fabrice Aunez)Seems to happen, I am very grateful to you, thank you very much! You helped me a lot!

Re: Calculate the sum of the week for the current year (eg 2014), but on the condition that if in this same week data were last year (2013).
Fabrice Aunez Mar 14, 2014 10:28 AM (in response to Anton sineok)you are the wellcome










