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: 
ziabobaz
Creator III
Creator III

p() as dimension

Hi,

I have:

I want to count numbers of SOLD orders which were CREATED in a period:

count(

{< Order= P({<status={'sold'}>})* P({<status={'created'}>}), status={'sold'} >}

DISTINCT Order

)

My period is august 2018 and the formula returns 1 (Order '300'), which is correct.

Is there a way I can define a flagCreated,

- when selected, the formula remains the same

- when deselected, the formula ignores P() function and returns 2 (Order 100 and order 300)?

The only wat I managed it by creating text variable, which returns P() when selected and returns nothing when deselected, so i subsequently put this varianle into the formula above, but is there a more elegant way?

Thank you

5 Replies
ziabobaz
Creator III
Creator III
Author

Screenshot_10.jpg

sunny_talwar

Is there a way I can define a flagCreated,

- when selected, the formula remains the same

- when deselected, the formula ignores P() function and returns 2 (Order 100 and order 300)?

What is selected or deselected here?

ziabobaz
Creator III
Creator III
Author

a field, a button, something... essence

i want to create it so i can select it

i will try to clarify

in the load script:

Load

Date,

Order,

if (status='created', 1,0) as flag;

So when i select 1 later in the front end, it shows only created order in the given time frame.

But this flag is static, so when the period changes, the flag also should change, therefor I have to use P()

the question is - is it possible to avoid using P() ?

sunny_talwar

Not sure I am able to follow your question here...

marcus_sommer

Based on your provided table-snippet I could imagine to add the created period to the sold-record of an Order, for example with something like this:

t:

load Date, Order, status from source;

     left join(t)

load Order, 'sold' as status, monthname(Date) as period_X

resident t where status = 'created';

By selecting your wanted periods within period_X and an expression like count(distinct Order) should return your needed numbers.


- Marcus