Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In this expression
If(DIMENSIONALITY()=2,SUM({<STATE_ID *= p(USER_STATE_ID) >}POPULATION),SUM(POPULATION))
I would like to replace p(USER_STATE_ID) with something like p(osuser()) or a variable representing the user name, but I cannot find the correct syntax. Is it possible ?
Create a variable like this
vOSUser = OSUser()
Note: Osuser will the system login name
I did try it with a variable, but when I replace p(USER_STATE_ID) with p($(var_username) ,
so the expression will be If(DIMENSIONALITY()=2,SUM({<STATE_ID *= p($(var_username)) >}POPULATION),SUM(POPULATION)) it doesn't work .
>}POPULATION gets underlined red.
You could not use osuser() within p() but you could apply it in this way:
If(DIMENSIONALITY()=2,SUM({<STATE_ID *= {'$(=osuser())'} >}POPULATION),SUM(POPULATION))
whereby I assume it won't return your wanted results ... If not you should elaborate a bit more what fields contain which data and what do you want to achieve.
- Marcus
I am trying to restrict access to detailed information, but allow access to aggregated values.
Something similar to the solution Swuehl made here :
Best I have that may be of some help is the following Design Blog post:
https://community.qlik.com/t5/Qlik-Design-Blog/Data-Reduction-Using-Multiple-Fields/ba-p/1474917
@swuehl any chance you have a little time to swing by and take a look at this post given reference to one of your prior ones to see if you can shed any further light upon things for the poster? Thanks in advance if you can.
Regards,
Brett
Sure, Brett.
@curiousfellow, could you describe your data model a bit more detailed? In the post you referenced above, the OP posted three simple tables as INLINE tables, to demonstrate his data model. Something like this adapted to your setting will help us better to help you.
My data model does not differ from the datamodel in your example (Qlik example SA_2.qvw). The only difference is that all the data from States and Population are in the same table.
In the meanwhile I managed to solve it for me. Referring to your example I linked te fields USER_STATE_ID and STATE_ID. Username represents the osuser() name.
I added a calculated dimension to my chart : if(USERNAME=var_OSUSER,STATENAME,'-'), works for me so far, only when details are presented, the totalvalue is presented too.
var_USER = osuser()