Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Asanchez77
New Contributor

how to make a year bar chart whit the minus year equal of the sum of values of the rest

i have a lot of dates with an amount , i want to create a bar chart by year thats shows the amount of each year, and in the year 2008 i want to sum the amounts of year 2008 and the previus 2007 2006 2005...

 

 

2 Solutions

Accepted Solutions
Highlighted

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

May be like this

If(Year = 2008, Sum(TOTAL {<Year = {"<=2008"}>} Measure), Sum(Measure))

If this is something you want to do based on selection...then may be this

If(Year = Min(TOTAL Year), Sum(TOTAL {<Year = {"<=$(=Min(Year))"}>} Measure), Sum(Measure))

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

You don't want to see 2008 or lower year? may be this
Sum({<Year = {">2008"}>}[amount)
11 Replies

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

So, 2009 would be the sum of all years from 2009, 2008, 2007, 2006, 2005 and 2010 will be sum of 2010, 2009, 2008, 2007, 2006, 2005...? Is this what you want?
Asanchez77
New Contributor

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

almost, only 2008 its the sum of the rest of years (2007,2006,2005....) 2009 2010 etc only the sum of that year

thanks for the answer

Highlighted

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

May be like this

If(Year = 2008, Sum(TOTAL {<Year = {"<=2008"}>} Measure), Sum(Measure))

If this is something you want to do based on selection...then may be this

If(Year = Min(TOTAL Year), Sum(TOTAL {<Year = {"<=$(=Min(Year))"}>} Measure), Sum(Measure))
Asanchez77
New Contributor

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

I used it in a test data with only year in date field and it works, but mi data have 00/00/0000 format, i tried to use the function year but i makes me an error 

 

if(year([DEFAULT DATE])=2008,sum(TOTAL{<year([DEFAULT DATE])={"<=2008"}>} [amount]), Sum([amount)/1000000)

the second year makes the error in set modifier expresion

thanks for the answer

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

Perform this in the script to create a new field

year([DEFAULT DATE]) as Year
Asanchez77
New Contributor

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

that works , thank so much, i have another issue, i need only apears year betwen 2008 and the max, i fixed the data in 8 to make that ,but when i selected a field it shows years like 2000 1998..

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

I don't think I understand the issue. Would you be able to explain with an example?
Asanchez77
New Contributor

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

if there are more years in the x axis below 2008 i want to dont show only the bars wich value are 2008 or greater

Re: how to make a year bar chart whit the minus year equal of the sum of values of the rest

You don't want to show 2008 or greater? I am still not sure I understand what the goal is