Skip to main content

I need to integrate two tables in a data model. The problem is : I create the tables distict values, but even for that the data model is failling to load. I´ve trying different ways to solve that, but not sure how to finish that up.Screenshot 2024-02-09 154645

Hi group! I am still trying to figure it out.. any suggestions would be really appreciated.


Hi @joyce.cardo12,

 

I assume you tried the SELECT DISTINCT clause in the tables. In case you did not, I had a similar problem where my case table had duplicate keys because of problems in a dataset. Mind that this approach might not solve your problem but will put you in the right track.

 

To have my case table have unique values, I retrieve the maximum cumulative net worth and maximum resource value for each unique case ID from the “Dataset” table. The result will show one row per case ID, with the maximum net worth and resource values associated with that case.

 

SELECT CASE_ID, MAX(NET_WORTH) AS MAX_NET_WORTH, MAX(RESOURCE) AS RESOURCE

FROM (

 SELECT

 "Dataset"."Case ID" AS CASE_ID,

 "Dataset"."Cumulative net worth (EUR)" AS NET_WORTH,

 "Dataset"."org:resource" AS RESOURCE

 FROM "Dataset"

) AS subquery

GROUP BY CASE_ID

 

Again using MAX might not be suitable in your situation, but hopefully it will put you in the right track.

 

Kind regards,

Sverre


Hi group! I am still trying to figure it out.. any suggestions would be really appreciated.

Hi @joyce.cardo12,

 

Did you figure it out already?


Reply