Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
FLASH SALE: Save $500! Use code FLASH2026 at checkout until Feb 14th at 11:59PM ET. Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Detail

Hi ALl ,

Can someone please explain me what does the below expression does.

=if(Ceil(Count(aggr(Count(DISTINCT

  {$<

 

  Dept= P(Dept_S)

  >} Cust_ID

),Cust_ID))/vRowsLD)=0,1,

Ceil(Count(aggr(Count(DISTINCT

  {$<

  Dept= P(Dept_S)

  >} Cust_ID

),Cust_ID))/vRowsLD)

  )

Thanks in Advance

1 Solution

Accepted Solutions
effinty2112
Master
Master

Hi John,

          $< Dept= P(Dept_S)> does not look right. Is Dep_S a value of the dimension Dept? If so then

$< Dept= {'Dep_S'}> instead.


Set modifiers using P() and E() take a form like

{$<Customer = P({<ShoeType = {'Sandal'}>})>}, this defines the set of customers who have bought sandals. You can use this set modifier in aggregations like


Sum({$<Customer = P({<ShoeType = {'Sandal'}>})>}[Order Value])


Which will return the sum of order values of all orders (whether they included sandals or not) from customers who have ordered sandals. It's like if in a dashboard you select 'Sandal' in ShoeType, then you select all possible customers and then you clear the ShoeType field.


If you replace the P() with an E() the expression will the sum of all order values from customers who ,according to the current data model, have never bought sandals.


Whenever I write a P() or E() expression I always begin by typing three sets of brackets that are always required


P({<>})


then fill in the rest.


Hope this is of help


Andrew

View solution in original post

2 Replies
avinashelite

They are trying to set a value base on the conditions that is done by if(condition=0,1,other_value) condition

Ceil(Count(aggr(Count(DISTINCT

  {$<

  Dept= P(Dept_S)

  >} Cust_ID

),Cust_ID))/vRowsLD)

// trying to count the DISTINCT number of customer according to the possible Department selections(this is in set analysis part ) but this expression looks odd for me

Ceil is to get the whole number like rounding off , check help for more details

Hope this helps you 

effinty2112
Master
Master

Hi John,

          $< Dept= P(Dept_S)> does not look right. Is Dep_S a value of the dimension Dept? If so then

$< Dept= {'Dep_S'}> instead.


Set modifiers using P() and E() take a form like

{$<Customer = P({<ShoeType = {'Sandal'}>})>}, this defines the set of customers who have bought sandals. You can use this set modifier in aggregations like


Sum({$<Customer = P({<ShoeType = {'Sandal'}>})>}[Order Value])


Which will return the sum of order values of all orders (whether they included sandals or not) from customers who have ordered sandals. It's like if in a dashboard you select 'Sandal' in ShoeType, then you select all possible customers and then you clear the ShoeType field.


If you replace the P() with an E() the expression will the sum of all order values from customers who ,according to the current data model, have never bought sandals.


Whenever I write a P() or E() expression I always begin by typing three sets of brackets that are always required


P({<>})


then fill in the rest.


Hope this is of help


Andrew