Hi Everyone, I originally had a data model where T...
# gooddata-platform
a
Hi Everyone, I originally had a data model where Table A was directly connected to both Table B and Table C. Table A and Table B had a fact established between them, which was working as expected. However, I encountered a limitation where I couldn't establish a direct connection between Table B and Table C. To resolve this issue, I created a bridge table, Table D, which connects Table A to Table B and Table C indirectly. I removed the direct connections between Table A and Table B, and Table A and Table C, and established a new connection through the bridge table. After making these changes to the Logical Data Model (LDM), I noticed that the existing fact on Table B was no longer returning the correct results. For example, a specific record in Table B has only 2 associated identifiers when we do sum on the fact, but the fact is showing a count of 14 on summation. This discrepancy appears to be caused by the multiple entries in the bridge dataset for each associated record in Table C. Is there a way to correct the fact to return the correct count, rather than relying on a workaround? Can the fact be modified or redefined to account for the changes in the data model and return the accurate results?
j
Hi Abhishek, yes this is a known issue for similar setups. The GoodData docs on many-to-many models point out that any fact sliced by a multi-valued attribute will repeat for each bridge link, causing the classic “double-counting” issue (“Double-Counting in an M:N Model” section of the M:N in LDM guide: https://www.gooddata.com/docs/cloud/model-data/evolve-your-model/many-to-many-in-ldm/#double-counting-with-mn). One simple way to collapse those duplicates is to scope your count at the B level using MAQL’s BY keyword—e.g.:
Copy code
SELECT SUM(1) BY [B.id]
(see the “BY” keyword reference here: https://help.gooddata.com/doc/growth/en/dashboards-and-insights/maql-analytical-query[…]y-keywords/overriding-insight-attributes-with-by-keyword/by/ For a broader overview of GoodData data modeling patterns, I would strongly recommend you to check out the University courses on Data Modeling: https://university.gooddata.com/tutorials/data-modeling/
a
Thanks @Julius Kos.