Skip to main content

Hey, newbie is here.

Absolute trivial situation, but didn't manage to handle it so far.

So, there are tables:

"users" (id, name, etc)

"questions" (id, answered_user_id, date)

"comments" (id, question_id, user_id, date)

What i need is to get ⌗answers and ⌗comments for particular user at particular time. I've create separated dimension "date" and made following joins:

users-questions (inner,by user_id)

questions-date (inner,by date)

date-comments (inner by date and user_id)

Looks right to me, but figures doesn't make any sense. Thank you in advance, any help is appreciated

5 respostas
  1. 3 de set. de 2023, 09:04

    Hi Oraz,

     

    If you're comfortable with joins, you may want to prepare a Logical Table as follows:

     

    1) UNION the questions and comments tables (right in Tableau)

    2) 'ALIGN' the 'same entity' columns using the Tableau-generated [Table Name] as the anchor:

    // aligned_question_id

    CASE [Table Name]

    WHEN 'questions' THEN [id]

    WHEN 'comments' THEN [question_id]

    END

    // aligned_user_id

    CASE [Table Name]

    WHEN 'questions' THEN [answered_user_id]

    WHEN 'comments' THEN [user_id]

    END

    // aligned_date

    [date]

    3) JOIN the users table with the Unioned one by the [aligned_user_id] Join Calculation on the left

     

    Step 3 has to be prepend the step 2, I just show the calcs first to explain the Join to be made.

     

    Yours,

    Yuri

0/9000