Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

In tableau how to show unmatched row in my case?

I'm new to tableau.

I have a data like this.

[department]

enter image description here

[employee]

enter image description here

And I want to get employee count under 30 age per department. like this..

[my goal]

enter image description here

I want to show all departments (if there is no employee)

To get result, I do these steps,

  • make relationship of dept - emp (one datasource)
  • make datasource filter (emp.age < 30)
  • make sheet and set row as dept_no, countd(emp_no)

But I could only get like this.

[my result]

enter image description here

How can I get my goal..!!?? Help me!!

question from:https://stackoverflow.com/questions/65857180/in-tableau-how-to-show-unmatched-row-in-my-case

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It is simple hereafter. Use join (instead of relationship) on the side of dept table and Take dept_no column from dept_table instead of emp_table. To do this follow these steps

  • double click on first added table (say emp). A join window will open (thgis differs from relationship)

  • add dept table and use right join

enter image description here

  • right click age convert to dimension

  • right click again age and convert to continuous

  • create filter at most 29 on age and don't forget to check include null values in the table

enter image description here

  • If you want to add all values in view. create a calc field with calculation as
INT([Age] <30)
  • add sum of this field to view

enter image description here

  • edit the calculation to show all nulls as 0
ZN(INT([Age] <30))

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...