I am in some trouble with multiple measures selection. I am having two tables (A & B) joined as 1:1. I have one measure in table A (MA1) and two measures + one dimension from table B (MB1, MB2, DB1).
Multiple measures in parameters is not selected:
Now, when I select MA1 (from table A) and MB1, DB1 (from table B), I get correct results. When I add MB2 with this, I get wrong results.
Multiple measure in parameters is selected:
Not getting correct results by selecting MA1 and MB1, DB1 (although getting seperate SQL queries).
I want a report where I have MA1, MB1, MB2 and DB2 (one measure from one table and two measures + one dimension from second table).
I am smelling a chasm/fan trap here. Please spare some time to help me
Thanks.
P.S.: Ideally, I wanted to have all measures coming from single table/context which is not in this case (considering the universe/model)
Allthough you specify 1:1 for the join cardinality, this does not have any effect on the results. It’s only needed to detect contexts.
I suspect that the real join is more like 1:N or M:N.
Create an alias for table B, join this alias to table B and A.
Create separate contexts for both joins.
Create the dimension object from the alias, the measures from table A and B.
If you need more help, I suggest giving examples for the data in the tables and describing the wrong results.
Thanks for the quick reply. I am little confused in the contexts here Currently, I have two tables A & B. I created alias for table B (B’).
Now, the joins created:
A & B’ (Context 1)
A & B (Context 2)
The objects I select on webi:
Dimension from B’
One measure from A + Two measures from B
But, when I run the report, I get two different tables (and I suppose thats because I now have two different queries). By wrong results I meant that the count information is not correct when I view the report containing three measures (two measures and one dimension from one table + one measure from other table) with multiple measure selection option not ticked and without any alias/contexts.
Could you please help me out with the contexts here… And thank you so much for your time…
Which is meant to be the way the tables sit?
As highsandstoned mentioned, it’s probably not a 1:1.
Are there other tables joined to either of these?
If you have A -< B and measures from both, create an alias of A, A_Fact
take your measures from A_Fact, any dims from A and anything that should be from B, from B.
Your problem is that a fact from A has no relation to a dimension from B.
I cannot relate my batch shipping cost measure from A directly to any given order line reference number in B for example.
Table A and Table B joined on Universe (Table A.Column = Table B.Column).
Table A:
Dimension Object - A1
Measure Object - Count(distinct(A1)) - Let’s name it MA1
Table B:
Dimension Object - B1
Measure Object - Count (B1) - Let’s name it MB1
Measure Object - Oracle Extract function used to compute a value (I have made this as Measure) - Let’s name it MB2
Now, I want to create a report where I have :
B1, MB1, MB2, MA1 (These should be grouped by B1 dimension). As of now, the cardinality stands out to be 1:1.
When I run B1, MB1, MA1 I get correct results, but when I add MB2 I end up with incorrect records.
What does that mean? What does it do? Does it do it on the fly rather than being an actual table value? Does it belong to table B? Can it be pre-calculated?
Telling us what A and B are may help - e.g. region and sales
the cardinality setting in the universe does not have ANY effect on results produced!
Is this really a measure ? extract function returns a date ? You classified the other measures with aggregate functions, is there any aggregate function for this measure ? If not, it will be in the group by clause!!! (thus actually behaving like a dimension.
Yes, I was pondering upon the same issue. This object is calculating the difference between start datetime and end datetime (and the result is the time difference in minutes, which should be aggregated on report layer to have sum functionality on this column). Also, the results should only be grouped by one dimension (of second table).
I guess I should just have a look at the design once more (just to make sure we have the right objects at the universe and report level (variables))
Thank you so much Mark & highandstoned, really appreciate your time and efforts :). May be, I well post a reply after some introspection of the design
I believe creating the object for extract function (time difference) on report level would solve the problem as the report will get grouped by on only one dimension (with both measures from different tables). The idea is not bad (although, I loose slight re-usability here)…
Once again, Thank you Mark and highandstoned
P.S.: I will post one final analysis of the problem (with the solution once I am done with it, guess it will help people with similar issue in future).
I wish we could do that Mark, seems slightly tough now to have this change Creating it at the report level should solve the problem (however I am skeptical about the performance of the report). I am still exploring for better solutions if any…
As long as this time difference is calculated between two columns in the same table, I don’t see what has to do with his problem ?
(with regards to incorrect results, not to performance 8) )
As long as you do something like sum(dateend-datestart) and not just dateend-datestart.
I do worry about the count(distinct). That could easily lead to false results.
Some general rules:
create measures with aggregate functions in the select
don’t create measures and dimensions from one universe table, use aliasses
don’t create objects from a table, alias every table (so you would have something like TableA, DimensionAliasTableA, MeasureAliasTableA)
I figured out my mistake (and please don’t boil me in hot water for this ). The extract function was written without the sum part. I rectified it sum(extract()) and it is working fine now.
Time for a coffee after that stupid blunder (and of course Cheers to Mark and highandstoned )