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
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?
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() ?
Not sure I am able to follow your question here...
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