Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear friends,
I have written an expression using If in the below manner -
Sum(IF(PrevMY=InvMonthYear, InvoiceAmount, 0))
Note: in the above expression PrevMY, InvMonthYear and InvoiceAmount are the fields in QVD files.
Can anyone help me to write Set Analysis equivalent expression of the above one?
Thnaks in advance.
Ishraque Ahmad
Hi Ishraque,
Let try this SUM({$<PrevMY = {$(InvMonthYear)}>} InvoiceAmount)
Let me know if this one working.
Regards,
Sokkorn
Hi Sokkorn,
Thanks for your reply. Applying this expression gives different result than the Original one.
The result of your suggested expression is equivalent to the result of Sum(InvoiceAmount)
Thanks and Regards.
Ishraque Ahmad
try the following
SUM({<PrevMY = {"$(InvMonthYear)"}>} InvoiceAmount)
Hi,
Please see the attached file,i hope this will help u
Thanks,
Vivek
Hi Ishraque,
Try to load data like this
[tmp1]:
LOAD *,
IF(PrevMY=InvMonthYear,1,0) AS Flag;
LOAD * INLINE [
No,PrevMY,InvMonthYear,InvoiceAmount
1,2009,2009,30
2,2009,2010,40
3,2010,2010,50
4,2010,2011,60];
Then use set analysis SUM({$<Flag = {1}>} InvoiceAmount)
Regards,
Sokkorn
Dear friends,
I am not yet able to solve the issue.
I have extracted the faulty piece of code in Sample.qvw file and uploading it for your reference.
Please see the prectical problem and guide me if possible to apply the correct syntax of Set Analysis.
Thanks and Regards.
Ishraque Ahmad
Hi Ishraque,
For me I think that you don't need to do a set analysis. Because in this case you have used disconnect table and it can be slow on printing data (test it with 10,000 record will see the problem).
Now I have one solution for you. Let try it
- Use only one table [InvoiceHeader]
- Create one Pivot Table with [InvMonthYear] as Dimensions and SUM([InvoiceAmount]) as Expressions.
- If you need to create template like your object (horizontal in MonthYear), you need to drag column [InvMonthYear] from vertical to horizontal.
- If you need to sort InvMonthYear then try do it in Sort tab with expression:
Match(LEFT(InvMonthYear,3), $(=chr(39) & Replace(MonthNames, ';', chr(39) & ',' & chr(39)) & chr(39))) + (RIGHT(InvMonthYear,4)*100)
See the sample attached file.
Hope it help you.
Regards,
Sokkorn
Hi Sokkorn,
Thanks a lot for your reply that has helped me improving my knowledge.
The sample I have attached in my previous reply is not my exact requirement (as I have mentioned it is extracted columns, records and KPI).
There are few points in my application which will give you some idea to understand my requirement as -
Main Issue is why SET is not comparing 1 field value with another field value whereas IF behaves as expected? I feel my syntax is wrong and hence want to arrive at the correct syntax.
Thanks and Regards.
Ishraque Ahmad