0

i have a column which name "Period" and i have last 18 months ( janvier 2021 to novembre 2022)

enter image description here

In my graph i want show only month december 2021 to novembre 2022. I would like to show months beetwen last month of the year and current month.

Thanks in advance for your help :)

Juji
  • 11
  • 6

1 Answers1

0

You can use set analysis to achieve this:

Sum(
    {<[Period] = {">=$(=AddMonths(YearStart(Today()), -1))<=$(=Today())"}>}
    [FieldToSum]
)

This set expression works by using:

EDIT: See below screenshot

Screenshot of Qlik Sense expression editor with evaluated expression preview area highlighted

SmoothBrane
  • 721
  • 4
  • 5
  • Hi @SmoothBrane, i test the expression but it's not work: =Sum({$=$(=AddMonths(YearStart(Today()), -1))<=$(=Today())"},type_de_stock_detail={'Buyer'},fact_type={'Fact_Stock'},[Type période]={'Month'},pivot_date_type={'Date stock'}>}amount1+amount2+amount3+amount4) – Juji Nov 22 '22 at 19:49
  • See the screenshot I just added to my initial answer -- when you look at the expression in the Expression Editor and you look at the preview box at the bottom, do you see `">=12/1/2021<=11/22/2022"` as is highlighted in my screenshot? Or do they appear as dashes `>=-<=-`? – SmoothBrane Nov 22 '22 at 20:31
  • Yes i see date , i use QlikView for the moment. I try again your expression – Juji Nov 22 '22 at 20:59
  • Remember to apply the set analysis to a field that has a date type. The set analysis will return nothing if that period field in your example is just text that looks like dates. You should be able to copy and paste that exact ">=12/1/2021<=11/22/2022" into the list box search and get the results you want. @smoothbrane looks like their data is a dual, text and number, to make this work. Also remember you can apply the set to the normal date field and still keep period as your dimension and still get the correct results – The Budac Nov 25 '22 at 08:28