
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Retreiving a Value from last month with a condition
After trying a long time, I came here for help.
Within a table , I would like to retreive a reference from last month, given that the value of an other variable = 1 in the data. However I cannot create the correct formula to solve this issue in Qlik Sense.
DelLateCarrier should be the value that is 1
Reference is the number I want to have/retreive in the table, when for that reference the Dellatecarrier is also 1 in the previous month.
I have tried some of the below formula's and combinations / adjustments of those. Could someone help me out?
if(month(AddMonths(Today(), -1))[#DelLateCarrier] = 1, Reference,)
----------------------------------------------------------------------------------------------------------------------------------
if(Match(valuelist(({$<Month={$(= Month(AddMonths(today(),-1)))},Year={$(=Year(AddMonths(today(),-1)))})),[#DelLateCarrier]), 1), Reference,)
----------------------------------------------------------------------------------------------------------------------------------
if(match({$<Month={$( = Month(AddMonths(today(),-1)))
----------------------------------------------------------------------------------------------------------------------------------
Count({$<Month={$(= Month(AddMonths(today(),-1)))},Year={$(=Year(AddMonths(today(),-1)))},[#DelLateCarrier]={1}>}DISTINCT([Reference]))
----------------------------------------------------------------------------------------------------------------------------------
if(match([#DelLateCarrier] month(Today(), -1),1),Reference,)
----------------------------------------------------------------------------------------------------------------------------------


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What does the table look like? Are there multiple rows for each value of Reference, with different dates?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Each value for reference is unique and has different dates, but I want to base the formula only based on 1 date (Delivery actual). I tried to solve this with the following formula using multiple AND statemens in an IF statement.
data example:
Reference | Dellate carrier | delivery actual |
1245698 | 1 | 20-11-2021 |
6548524 | 0 | 08-11-2021 |
4500653 |
1 | 16-10-2021 |
2346689 | 0 | 22-12-2020 |
if([#DelLateCarrier]=1 and month([Delivery actual])=({$(= Month(AddMonths(today(),-1)))})
and year([Delivery actual]) = ({$(= Year(AddMonths(today(),-1)))}, Reference)
also with the following formula, which is the previous one but a little adjusted.
if([#DelLateCarrier]=1 and month([Delivery actual])=({$<Month={$(= Month(AddMonths(today(),-1)))}>})
and year([Delivery actual]) = ({$<Year={$(= Year(AddMonths(today(),-1)))}>}, Reference)
So basically I only want it to return the reference value and row if, for that reference the value of dellatecarreir =1 and the date is in november for delivery actual.
