Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

HELP! Select the previous period and the current selection together

Hello! I would like to get the unique clients from the current selection (selected month-year) to back, being clear all the records of the period including the selected date but excluding subsequent dates (months-years).


The field with which the customer is identified is DOCUMENTO.


The date fields that I have only selected are 2: MES and AÑO , in English MES is month and AÑO y year. I have selected to May 2017, so I do not want to bring me the following months.

Thanks very much community

6 Replies
beck_bakytbek
Master
Master

Hi Maximiliano,

try this:

Sum ({$<Year ={"($=max(Year))"} >}YourField) for current year

Sum ({$<Year ={"($=max(Year(Today)-1)"} >}YourField) for last year year


i hope that helps


Beck

Anonymous
Not applicable
Author

Hi,

For example

Sum({<Year = {$(=max(Year))},YearMonth = {"<=$(=max(YearMonth))"},Date={">=$(=vMinYearDate) <=$(vMaxYearDate)"}>}Sales)

I am using this expression to show This year numbers and

Sum({<Year = {$(=max(Year)-1)}, YearMonth = {"<=$(vLYYearMonth)"},Date={">=$(=vMinLYearDate) <=$(vPreviousYeardate)"}>}Sales)

this one to show last year YTD numbers . These expressions will show the numbers till today from the begining of the year and last year begining to same date last year.

This may helps.

Anonymous
Not applicable
Author

Hi Beck, first and foremost, thank you for your time, I could not make your formulas work, the modifications a little and I could make the first one work, but it's not what I'm looking for either, I do not really understand what the number is bringing, what the logic is.

This is the formula Count (distinct {<FieldNameYEAR = {"<$ (= Max (FieldNameYEAR))"}>} DOCUMENT) .

Footnote: it is easier to name the fields as well (FieldNameYear) since if you only put me Year I do not know if it is the name of the field or it is a function or variable.

Anonymous
Not applicable
Author

Hi Sada, thanks for writing! The truth that I could not apply the formulas, mainly because I do not know your variables like vMinYearDate.

Footnote: we could name the date fields as NameFieldYear so it is not confusing if in the formula you put a function or a field.

Thank you!!

beck_bakytbek
Master
Master

Hi Maximiliano,

look at this example

i hope that helps

Beck