Search for answers here or ask a question
0

Retaining unique row combinations from query preview to discover

Hi there,

In my SQL query preview section (first screen grab) which has two columns, 'Section_Reference' and 'Max_NSP_24Months', I have unique row combinations.

I'd essentially like what is seen in the preview section to be replicated as a discover so that each Section_Reference has it's corresponding Max_NSP_24Months value.

However, in the data model section (second screen grab), which ever measure function is used (whether that be Sum or Average), that function considers the entire Max_NSP_24Months column and applies the result to each Section_Reference  (see third screen grab showing the sum of the entire Max_NSP_24Months column being applied to each Section_Reference).

Any help/advice would be greatly appreciated.

Thanks,

Ben

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Ian MacdonaldAdmin
    • Team Lead - Product Management
    • Ian_Macdonald
    • 1 mth ago
    • Answer
    • Reported - view

    Hi Ben,

    It looks to me, without seeing the whole model, that the table containing Section_ Reference and Max_NSP_24Months is not properly joined to the Table containing the Section_Reference column used in the Discover Query. As there is no valid join, you are getting all Max_NSP_24Months values aggregated for each Section_Reference.

    Please check the above and / or provide further information here on the rest of the model so we may help you further.

    Hope that helps.

    Ian

    Like 1
    • Ian MacdonaldAdmin
    • Team Lead - Product Management
    • Ian_Macdonald
    • 1 mth ago
    • Reported - view

    Hi Ben,

    Have you resolved this or do you still need some help? As above, we'd need some detail on your model to help further.

    Ian

    Like
Like Follow
  • Status Answered
  • 1 mth agoLast active
  • 2Replies
  • 33Views
  • 2 Following