vhadalgi
vhadalgi

Reputation: 7189

Row level implementation tableau

I got data like below

vendor,Buyer,Region,Amt,qTY
Rad_1,X,R1,1000,10,5
Rad_2,Y,R2,1500,20,5
Admin,X2,R1,2000,30,5
Rad_4,X3,R3,4000,20,7

when vendor Rad_1 logs into tableau server he should be able to see only the 1 & 3 rows because of "R1" Region similarly for vendor Admin.

**User should view only data from their own region

How do i implement this ?

i tried giving this

Username()=[vendor] in calculated field with filter ="true" but doesnt waork as expected

Upvotes: 0

Views: 150

Answers (1)

Inox
Inox

Reputation: 2275

Don't know what is going wrong with USERNAME() = [Vendor], but that will definitely not show all regions to the user.

What I would do is create 2 fields. One named [User_region]:

CASE USERNAME()
WHEN 'XXX' THEN 'R1'
WHEN 'YYY' THEN 'R2'
...
END

And then I would create the bool filter:

[User_region] = [Region]

It's important that User_region and Region are of the same type (e.g. both are strings) so you can trust what will come out of this filter.

Of course this would be painful if you have thousands of vendors. I'm trying to think of a way to use your actual table to discover the user region, and then use it as a filter, but I can't think of anything right now.

EDIT:

You can create groups of users, but that could be as painful as the solution above. The advantage is that past a certain limit of expressions, Tableau won't let you create the calculated field, while groups can be as big as you wish

Relate to this: http://kb.tableausoftware.com/articles/knowledgebase/display-different-dimensions

Another solution, though not elegant, nor very efficient, is to have a string field with the names of all vendors of that region concatenated (e.g., for region 1 it could be "Rad_1Rad_3Rad_10") and then use CONTAINS() to check if the vendor is there.

Though this can be done in Tableau (using Previous_Value()), you will have to export the data and join with your database, so if you can do this before connecting your database to Tableau, I believe it's better.

And this could not be so efficient for very regions with many vendors. Don't know if there's a limit to string fields, but this can use a lot of memory, and probably CONTAINS() will not be very fast with enormous strings.

I'd go with the Group solution, and check if there's a clever way to create the groups

Upvotes: 1

Related Questions