1 Reply Latest reply on Sep 4, 2018 10:31 AM by Patrick Van Der Hyde

# Logic Calculations in Tableau with Conditions

I have a given case. How to solve this calculation in Tableau. Can some one please guide me how to work on it.

In the given case each ID has different charts and each chart has different codes. I need to Calculate three columns based on the given conditions.

* Column 1 - Total User Charts - Based on ID need to show how many charts went to each user level

conditions for this column - If user1 status =user2 status then count is 0 else  1, if user1 status =user 3 status then 0 else 1,

while comparing with user1 and user2 if user 2 is null then check with user 3 if user2 and user3 are null then 'N/A', No comparison between user2 and user3 status.

*Column 2 - Total errors in chart - Count of charts with errors based on user status

"Except delete code status all user status follow this rule" -

If user1 status =user2 status =user3 status then error count is zero.

user1 status= user2 then error count is Zero, user1=user2 but <>user3 then error count is 1, user1<>user2=user3 then error count is 1

When ever 'delete code' status come in to picture then comparison has to made between user1, user2  and user3 and then need to compare with second status existing below this 'delete code' status.

In first case both users are <> user3 so total error chart count is 1 and total error code count is 2,

In Second case all three users have delete code but second status  is not same so total chart error is 1 and total error code count is 1

user1 status user2 status user3 status
delete code delete code Delete
delete code delete codedelete code

*Column 3 - Total errors in code - Count of codes with errors based on user status

If user1 status =user2 status =user3 status then error count is zero.

user1 status= user2 then error count is Zero, user1=user2 but <>user3 then error count is 1, user1<>user2=user3 then error count is 1

In below case total code errors = 2

code user1 status user2 status z684 user3 status z794 delete delete delete auto code add z682 confirm confirm confirm auto code add
• ###### 1. Re: Logic Calculations in Tableau with Conditions

Hello Sunny,

Is is possible to share the work you have tried in Tableau and where you are stuck?   Rarely will other users in the community build a new viz from scratch based on a list of requirements.  I find the best way to engage with the community is to share what you have tried and where you are stuck.

Packaged workbooks and flows: when, why, how

Thanks

Patrick