Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

add years to a date value in set analysis

I need to add one year to the open date of each business unit in the set analysis

the following expression gives result yet the latter doesn't which I want

Please advise:

sum

          (

                    {

                    <

                                        H_Flag={'Sales'},

                                        [Open Date]={"<=$(max(

                                                                                          {<

                                                                                                    [AZ Year]={$(=max([AZ Year])-1)},

                                                                                                    [AZ Week]={$(=max([AZ Week]))}

                                                                                          >}

                                                                                          [H_Transaction Date] ))"},

                                        [Transaction Date] = {">= $(=min([Open Date]))"},

                                        CloseDateLFL={">=$(min(

                                                                                          {<

                                                                                                    [AZ Year]={$(=max([AZ Year])-1)},

                                                                                                    [AZ Week]={$(=max([AZ Week]))}

                                                                                          >}

                                                                                          [H_Transaction Date] ))"}

                              >

                    }

                    [Sales Amount USD]

          )

yet the following doesn't give any result

sum

          (

                    {

                    <

                                        H_Flag={'Sales'},

                                        [Open Date]={"<=$(max(

                                                                                          {<

                                                                                                    [AZ Year]={$(=max([AZ Year])-1)},

                                                                                                    [AZ Week]={$(=max([AZ Week]))}

                                                                                          >}

                                                                                          [H_Transaction Date] ))"},

                                        [Transaction Date] = {">= $(=AddYears(min([Open Date]),1))"},

                                        CloseDateLFL={">=$(min(

                                                                                          {<

                                                                                                    [AZ Year]={$(=max([AZ Year])-1)},

                                                                                                    [AZ Week]={$(=max([AZ Week]))}

                                                                                          >}

                                                                                          [H_Transaction Date] ))"}

                              >

                    }

                    [Sales Amount USD]

          )

I can walk on water when it freezes
1 Solution

Accepted Solutions
Not applicable

Hey Ali,

Try using the following in order to add 1 year to a date:

[Transaction Date] = {">= $(=num(AddMonths(min([Open Date]),12)))"}

Hope this will let you get your desired results

View solution in original post

1 Reply
Not applicable

Hey Ali,

Try using the following in order to add 1 year to a date:

[Transaction Date] = {">= $(=num(AddMonths(min([Open Date]),12)))"}

Hope this will let you get your desired results