Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
maxicarena
Creator
Creator

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

beck_bakytbek
Master
Master

sadasiva
Creator II
Creator II

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.

maxicarena
Creator
Creator
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.

maxicarena
Creator
Creator
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