what if we use the wrong relationship in join lookml

https://community.looker.com/technical-tips-tricks-1021/how-does-an-incorrect-relationship-affect-qu...

From the post above, we know that the relationship only tells if symmetric aggregates will be triggered. So in case of many to one and one to one case ( both does not trigger symmetric aggregates), do they impact the results if I mistakenly use one instead of another? The question for one to many and many to many.  The 2nd question: is the primary key necessary for all the views? 


 

Solved Solved
0 3 761
1 ACCEPTED SOLUTION

It will also have an impact when you create measures of type sum_distinct, average_distinct, and for all of them you need to have primary key defined as it’s used in the algorithm. 

View solution in original post

3 REPLIES 3

It will also have an impact when you create measures of type sum_distinct, average_distinct, and for all of them you need to have primary key defined as it’s used in the algorithm. 

Thanks, Dawes! Should it be sum and average instead of sum_distinct and average_distinct?  I assume they only have impact on the measures on the right table. 

Not necessarily. In your example it’s one_to_many vs many_to_many, so you’re also changing the meaning of the left side of the join. Depending on your data it could have an impact on both. I think especially many_to_many would be the case where *_distinct  measure types could be useful if you can’t aggregate multiple values but just one.

The best way is to try. If you can avoid *_distinct measure types and your data still behaves as it should, then you’re okay. I would say the *_distinct is the “next” step in case your data gets fanned out.

This is helpful resource: https://help.looker.com/hc/en-us/articles/4412117099283-The-problem-of-SQL-fanouts 

Top Labels in this Space
Top Solution Authors