Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

p() function to NOT ignore selection

I want the below to filter to the E1 Job # that is selected but using the function below it is ignoring the selection and showing all the jobs.

sum({<[E1 Job #] = p(JDE_Job)>}[Actual Units])


  • E1 Job# is using Alternate State 1 and JDE_Job is using Alternate State 2
  • It is filtering the sum to only those JDE_Jobs that exist so that is working
  • Now it needs to filter to the specific job within the E1 Job # field when selected but it ignores this filter

  • What am I missing?
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Makes sense. You are expliciting setting [E1 Job #]. That is replacing any user selection. What I think you want is the intersection of your set modifiers and the user's selection.

{$ * <...

-Rob

View solution in original post

9 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

What state is the object that holds this expression?

Not applicable
Author

1

Not applicable
Author

Rob, do you know what I am missing?  It should not be ignoring the selection from what I can tell but I dont use the p() regularly.  The table that houses the JDE_Job is unrelated to the table with the E1 field.  This application is only for discovery purpose for a data migration project. 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm not fully clear what you are after. But to reference something in another state you have to use the  State name in the expression. So if you want to utilize the JDE_Job selections from State2, I believe it would be:

sum({<[E1 Job #] = p(State2::JDE_Job)>}[Actual Units])


-Rob

Not applicable
Author

It is referencing the JDE_Job no problem.

The issue is when the user selects a specific value in the E1 Job #

selection box which is State 1, it still shows all possible E1 Job #s that

are in the JDE_Job,

It is not filtering down to the one selected even when the chart object is

using State 1 and the E1 Job # selection box is State 1. I tried putting

the {$< in but still it ignore the selection

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Makes sense. You are expliciting setting [E1 Job #]. That is replacing any user selection. What I think you want is the intersection of your set modifiers and the user's selection.

{$ * <...

-Rob

Not applicable
Author

So i need the p function using State 2  to understand the selections of the State 1 so the Possible values are reduced based on the selections in State 1

Not applicable
Author

Rob

I understand the logic I want is this:

"the intersection of all possible values in JDE_Job

          (regardless of the state because I dont care what was selected in JDE_JOB, just that the JDE_Job value in E1 Job # exists)

and the possible values based on selection made in [E1 Job #].  Correct?

If this logic is correct then I simply need to convert the getfieldselections() using $() expansion.  Or is there a simpler formula

sum({$<[E1 Job #] = p(JDE_Job)*GetFieldSelections([E1 Job #])>}[Actual Labor Hours])

The below is what i tried but I get 0 as result. 

sum({$<[E1 Job #] = p(JDE_Job)*p(JDE::[E1 Job #])>}[Actual Labor Hours])


Note:  JDE is stage name

Not applicable
Author

This appears to be working now.  Changed all expressions and reloaded. 

sum({$<[E1 Job #] = p(JDE_Job)*p(JDE::[E1 Job #])>}[Actual Labor Hours])

Thanks Rob!! See you in NYC