Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sifatnabil
Specialist
Specialist

Section access to switch between fields

Hi all,

I have a set of users who should only be able to see volumes. Another set should be able to see revenues and volumes. My data table is like this:

Date, Revenue, Volume, Product

1/1/2015, $1000, $500, A

1/1/2015, $1050, $400, B

Is there a way to create 1 chart where, depending on the user, it will display revenue or volume?

I am thinking of using OSuser() but not sure of the most sustainable way to do this. Thanks.

1 Solution

Accepted Solutions
prat1507
Specialist
Specialist

Hi Sifat

PFA the .qvw for your reference. Here I've used a variable to get the username using OSUser(), then for my user I've assigned BIT_REV =1(if you want to show revenue, or 0 if you don't)

              BIT_VOL =1(if you want to show volume, or 0 if you don't)

in an inline table.

Then using the condition if(only({<USERNAME={'$(=OSUser())'}>}BIT_REV)=1,1,0) in the Presentation tab to show the column Revenue and if(only({<USERNAME={'$(=OSUser())'}>}BIT_VOL)=1,1,0) in the Presentation tab to show the column Volume, I got the desired result.


Regards

Pratyush

View solution in original post

7 Replies
awhitfield
Partner - Champion
Partner - Champion

why not have 2 charts with a conditional show based on a variable set by a button?

Andy

sifatnabil
Specialist
Specialist
Author

Thanks awhitfield‌, I was thinking that this means doubling up on all the charts, i.e. 2 of everything. Would it be possible to have just one version of all charts but display 2 different fields depending on the user? I'm guessing in expression I have to do something like if(match(OSUser(),'Bob'),FieldA) but this seems tedious.

giakoum
Partner - Master II
Partner - Master II

if you hide the Revenue from some users using section access, it will show nothing on the chart.

So you could have one chart with 2 expression : sum(Revenue) and sun(Volume) and for some users the 1st one will just show nothing.

sifatnabil
Specialist
Specialist
Author

This actually works - the legend of the hidden field still stays though. Is there a way to remove that?

prat1507
Specialist
Specialist

Hi Sifat

PFA the .qvw for your reference. Here I've used a variable to get the username using OSUser(), then for my user I've assigned BIT_REV =1(if you want to show revenue, or 0 if you don't)

              BIT_VOL =1(if you want to show volume, or 0 if you don't)

in an inline table.

Then using the condition if(only({<USERNAME={'$(=OSUser())'}>}BIT_REV)=1,1,0) in the Presentation tab to show the column Revenue and if(only({<USERNAME={'$(=OSUser())'}>}BIT_VOL)=1,1,0) in the Presentation tab to show the column Volume, I got the desired result.


Regards

Pratyush

giakoum
Partner - Master II
Partner - Master II

is suppress when null checked?

sifatnabil
Specialist
Specialist
Author

Yes - that still keeps the legend on.