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

Help with expression

Good day, everyone!

I have some throuble with expr. I need to get sum(Sales) over my filter.

On first page i got total sum, it work correct:


Sum({<t35PRDWAER = {'RUB'}>} DECNRPRDEC),

where t35PRDWAER field is currency, DECNRPRDEC is sales

On second page i want to get this, but it doesn't work:

Sum({<t35PRDWAER = {'RUB'}, BVRPBEDVTZ <= (VTRBEGDVTR + year - (365/BVRZAHWVTR))>} DECNRPRDEC),

where BVRPBEDVTZ is date of sale, VTRBEGDVTR is another date field, BVRZAHWVTR is something else.


Please, help me write expression correct.


UPD1: MY FALSE, FRIENDS, i forget to tell that i got 'YYYYMMDD' format in date fields!

UPD2: HERE IS EXAMPLE.QVF, take a look, friends!

27 Replies
Vasiliy_Beshentsev
Creator III
Creator III
Author

Hello, can someone help me now?

vinieme12
Champion III
Champion III

Hi,

can you confirm what are you trying to acheive here? YTd, previous year??

(date(VTRBEGDVTR) + year - (365/BVRZAHWVTR)

Sum(

     {<

     t35PRDWAER = {'RUB'},

     BVRPBEDVTZ = {"<=$(=Date( AddYears(VTRBEGDVTR,1) - (365/BVRZAHWVTR) ,'YYYYMMDD' )}

     >}

DECNRPRDEC),

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Vasiliy_Beshentsev
Creator III
Creator III
Author

Hello!

Yes, previous year, update simplyfied condition here Re: Expression doesn't work (

vinieme12
Champion III
Champion III

so is this resolved now?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ahaahaaha
Partner - Master
Partner - Master

Maybe this is what you want?

Sum ({<t35PRDWAER = {'RUB'}, VTRBEGDVTR = {"=MakeDate(Year(VTRBEGDVTR), Month(VTRBEGDVTR), Day(VTRBEGDVTR))>=AddYears(MakeDate(Year(BVRPBEDVTZ), Month(BVRPBEDVTZ), Day(BVRPBEDVTZ)), -1)"}>} DECNRPRDEC)

Vasiliy_Beshentsev
Creator III
Creator III
Author

It works, but unfortunately shows incorrect sum. It's good solution to replace fields, but not in this case

Position of fields in condition is mean, i update simplyfied condition here, take a look Re: Expression doesn't work (

Vasiliy_Beshentsev
Creator III
Creator III
Author

Well i guess yes, due to the fact that it was revising the terms of the problem (see new discuss)

Vasiliy_Beshentsev
Creator III
Creator III
Author

Because i found a good idea in new topic so thats is solution:

i decided to make new field Flag which contains when payment make2016-12-27 11_19_24-Microsoft SQL Server Management Studio - __Удаленное.png

so now i need to thing how to divide this two sum(sales) into 2 KPI in qlik sense: first year payments and next years

upd: and i find the decision

i use

1. Sum({<t35PRDWAER = {'RUB'}, FlagYearPayment = {'next'}>} DECNRPRDEC) for next years payments

2. Sum({<t35PRDWAER = {'RUB'}, FlagYearPayment = {'first'}>} DECNRPRDEC) for first year payments

still search for decision un expressions in qlik sense...