on 02-26-2015 2:25 PM
Hi Everyone....I am relatively new to this programming environment and am still trying to understand how things work so any help would be greatly appreciated!!
I have 3 queries from two universes that I need to find which records in the first two queries are not in the last query.
Query 1 Query 2 Query 3
Universe 1 Universe 1 Universe 2
Num Num Num
Order Order Order
Change Change
I know I can merge the queries on the first two elements but I need to display the records in query 1 and 2 that do not have matching elements in query 3. Any ideas on how to accomplish this?
Thanks!!!
Hi,
try this :
1 - In each of your queries, bring any measures (let´s say measure1, measure2 and measure 3 for queries 1,2 and 3);
2 - For matches in Q1 and Q2 and not in Q3, use below formula :
3 - merge the three queries on [num order]
[results 1-2 not 3] = If ((not(IsNull([measure1])) OR not(IsNull([measure2]))) AND IsNull([measure 3]);"Desired num order";"Record is also on Query3");
Regards,
Rogerio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess I am too new to webi/business objects.....I am unfamilar with the [num order] object. I don't see it available in the universes I am using. Is it an object available to any universe that is created and if so, how do I access it?
This would be of great help if I can get this to work for several other reports that are waiting to be created.
Thanks!!
Wendy
Hi Rogerio!
I have added a variable to determine whether or not the value was in either of the first two queries and not the third. It is:
[WhereExistsVariable]=((Not(IsNull([Measure1])) OR Not(IsNull([Measure2]))) And IsNull([Measure3])) Then "Not in Third" Else "In Both"
However, I am getting #MULTIVALUE for some of the entries. I am displaying the merged values along with each one of the measure items in the report followed by the variable to determine where it exists like:
MergedValue(Num)
MergedValue(Order)
Change
Measure1
Measure2
Measure3
WhereExistsVariable
Any ideas exactly why this is happening? I do notice that if values of the two merged items appear in the first query but with different change factors it is pulling the measure value from the third query twice even though only one exists in the third query. Does that make sense?
Query 1
Num Order Change1 Measure1
Num Order Change2 Measure1
Query 2
Record Does not exist
Query 3
Num Order Change1 Measure3
So in this case I shoud recieve "in Both" and I am receiving the #MULTIVALUE error.
Thanks for all your assistance. It is greatly appreciated!!
Wendy
Just to be clear:
I should show "In Both" for the first Num Order Change1 combination and "Not in Third" for the second Num Order Change2 combination.
But for both combinations, I am receiving the #MULTIVALUE error with the Measure3 value being repeated for the Num Order Change2 combination that does not exist in the third query.
Hopefully this is clearer.
Hi Wendy,
You can try using Combined Query option in Query Panel.
Below logic could help in your case:
Query 3
MINUS
(QUERY 1 UNION QUERY 2)
This will give you data which is only in Query 3 and not in both Query 1 and Query 2.
Regards,
Yuvraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wendy,
Below link might help you to some extent:
The rule for combining query is there should same number of columns in all queries and their data type should be same.
In case the combined query option is not user-friendly for you, you may try to write a custom SQL.
By clicking on SQL button, you can click on Custom SQL and write your own query.
Regards,
Yuvraj
Thanks Yuvraj! I took a look at the link and it is great information for combining queries that are using the same universe. I will bookmark this link for future reference!!
However, what I am trying to do is combine queries that are done on different universes. I have one universe that I have a query that pulls all num and orders and another query that uses the same universe but pull the num, orders and changes. Then a second universe in which I pull the num, orders and changes from it. These universes deal with different finanical areas which is the reason they are not combined. Now I need to find which records in the first two queries and not in the third query to see which records have not been accounded for.
How do I go about this? I have tried to write an independent sql statement that does this but cannot create that query because it goes against more than one universe.
Any ideas would be great!!!
Thanks,
Wendy
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.