0
votes

image

Above is the image link of actual Tableau layout, along with table structure with before and after filter

I have two tables – Users and Categories

User Table: The user table has userid, name, title, channel, team, sub-team columns. from which I have filtered out three Title using Tableau filter. ~700 users

Category Table: This table has userid, category_name, sub-category_name, date columns. This table essentially captures which users has used which sub-category the most. ~15000 records

User table
LEFT JOIN
Category table

I have used left join on userid. I have filtered three titles using Tableau filter, now I have total 350 users along with category usage against each userid.

I need something like the output table, however, I also want to add Level of Details to all the columns. For instance, I want the numbers to change dynamically when I choose one of the 6 channels.

To get the number total number of users (350) I have created a calculated field with formula:

{ FIXED [Title Set]: COUNTD([UserID])}.

Also, to get the fixed total value by channel I have created a calculated field:

IF [Channel_parameter] = 'All Channels' THEN [Total Active Users (by Channel, title)]
ELSEIF [Channel_parameter] = '1' THEN {FIXED  [Channel], [TITLE_SET]: COUNTD(IF [Channel] = '1' THEN [UserID] END)}
ELSEIF [Channel_parameter] = '2' THEN {FIXED  [Channel], [TITLE_SET]: COUNTD(IF [Channel] = '2 THEN [UserID] END)}
ELSEIF [Channel_parameter] = '3' THEN {FIXED  [Channel], [TITLE_SET]: COUNTD(IF [Channel] = '3' THEN [UserID] END)}
ELSEIF [Channel_parameter] = '4' THEN {FIXED  [Channel], [TITLE_SET]: COUNTD(IF [Channel] = '4' THEN [UserID] END)}
ELSEIF [Channel_parameter] = '5' THEN {FIXED  [Channel], [TITLE_SET]: COUNTD(IF [Channel] = '5' THEN [UserID] END)}
ELSEIF [Channel_parameter] = '6' THEN {FIXED  [Channel], [TITLE_SET]: COUNTD(IF [Channel] = '6' THEN [UserID] END)}
ELSEIF [Channel_parameter] = '7' THEN {FIXED  [Channel], [TITLE_SET]: COUNTD(IF [Channel] = '7' THEN [UserID] END)}
END

However, when I select particular channel in parameter is gives me the correct result but when I select ‘All Channels’ it throws wrong result, which is 7 times of the actual 350 number. I tried multiple use cases with Fixed and Include functions but couldn’t get it right. Can someone help me?

1
I can't answer your question without knowing how [Total Active Users (by Channel, title)] is defined, but you could simplify the rest of your calc as IF [Channel_parameter] = 'All Channels' THEN [Total Active Users (by Channel, title)] ELSE {FIXED [Channel], [TITLE_SET]: COUNTD(IF [Channel] = [Channel_parameter] THEN [UserID] END)} ENDAlex Blakemore
assuming that it was a typo when you mapped 2 to 3 in the original calcAlex Blakemore
Thanks for the response! [Total Active Users (by Channel, title)] is { FIXED [Channel_set], [Title_set]: COUNTD([UserID])}. I tried the simplified version but it is giving the same result. When I select All-Channels as parameter it multiple the actual number with total number of Channels '7'. yes, that's a typo.Dharmesh

1 Answers

0
votes

The Fixed-function just with Title-set solved the problem.