Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
pitutiti
Contributor III
Contributor III

P() Function

Hi everyone, hope someone can help me. Is this a correct way of  using the P function?

Sum({$<Customer=P({<Min(TOTAL <Customer> InvoiceDate)>=AddMonths(MakeDate(CalendarYear, CalendarMonth), -2)>} Customer)>} InvoiceAmount)

I mean, can I use the Min(TOTAL <Customer> InvoiceDate)>=AddMonths(MakeDate(CalendarYear, CalendarMonth), -2)  ?

Regards.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

No, it's not.

{<Min(TOTAL <Customer> InvoiceDate)>=AddMonths(MakeDate(CalendarYear, CalendarMonth), -2)>}

is not a valid set analysis expression.

View solution in original post

4 Replies
swuehl
MVP
MVP

No, it's not.

{<Min(TOTAL <Customer> InvoiceDate)>=AddMonths(MakeDate(CalendarYear, CalendarMonth), -2)>}

is not a valid set analysis expression.

pitutiti
Contributor III
Contributor III
Author

Ok thank you so is there a workaround to achive this?

Regards

swuehl
MVP
MVP

To achieve what?

Sorry, but it's unclear what you want to achieve finally.

Maybe you can use an advanced search:

Sum({$<Customer= {"=Min(InvoiceDate) >=AddMonths(MakeDate(CalendarYear, CalendarMonth), -2)"} >} InvoiceAmount)

But I am not sure what your context is, e.g. the value of CalendarYear and CalendarMonth in the context Customer. Both fields need to show only one single value per Customer.

pitutiti
Contributor III
Contributor III
Author

Ok. I understand. What I wanted to achive is a pivot table to show the invoices amount given a month and a year but only for those customers which first invoice is in the period of the two previous months and the selected one. Like this one. Captura.JPG

Finally I got it mapping in the load script the first invoice date and using the following expression.

Sum( TOTAL AGGR(Sum({<FirstInvoiceDate={'>=$(=AddMonths(MakeDate(CalendarYear, CalendarMonth),-2))'}>}   InvoiceAmount), CalendarYear, CalendarMonth, Customer))

Thanks a lot for your time

Regards