10 Replies Latest reply: Dec 20, 2017 2:45 PM by Rahul Joshi

# Calculating sales growth

Hi Everyone,

I want to calculate semester on semester sales growth(2017S2-2017S1) as well as YoY sales growth(2017S2-2016S2).

NOTE: I want to make it dynamic i.e. if the data updates to 2018S1 sales the code should automatically consider the added semester as the latest one and give the sales growth accordingly.

I cannot figure out any logic for it. Please guide me towards the desired output.

Attached is a sample data. Thanks.

Best Regards,

• ###### Re: Calculating sales growth

Hi Raul,

Made a quick example with what you need.

Hope it helps.

• ###### Re: Calculating sales growth

Hi Felip,

Sorry I wasn't able to open it. Actually, I am looking for a qliksense solution and I think you have provided a qlikview file. Can you provide it for Qlik Sense.? Thanks.

Best Regards,

• ###### Re: Calculating sales growth

Hi Rahul, my mistake.

Attached the QVF file

• ###### Re: Calculating sales growth

Your solution is correct but I have to make it more dynamic in case the time period changes from Semester level to rolling 6 months that is to be refreshed every month.

• ###### Re: Calculating sales growth

If your semester or year changes, the Max(Year)  Max(Semester) will automatically change the expressions on the charts, what else do you need as changing?

Added two rows to the excel file

 Karan 2018S1 16 Rahul 2018S2 1

And got the attached file

• ###### Re: Calculating sales growth

In my input the semester will remain a string. I cannot change the input every time I refresh the data. You have changed the input(if I am not wrong) to split the semester into to separate columns which I am afraid won't work for me. Is there any other alternative?

• ###### Re: Calculating sales growth

Understood it now.

I've made some changes and the semester is still a string, but i would advise to keep the numerical parts, as its easier to treat in set analysis as a number rather than a string,

• ###### Re: Calculating sales growth

Hi Felip, I see that you are still using the created column, 'Year'. This is not solving the purpose. Let me put it this way, I want to create a dashboard in such a manner that it gives the sales growth every month. All the person needs to do is to input the raw data. The person whom I am handing this over to wont be able to create the column, 'Year'.

Can we still try and find any other alternative?

• ###### Re: Calculating sales growth

The column is created in script, not in the excel file, i havent change it, just transformed the Semester field you have there to two fields (Semester Number and Year) for easier handling of data and set analysis expression.

The raw data stays the same. The input i've inserted was the same as yours:

 Name Semester Sales Karan 2018S1 16 Rahul 2018S2 1

This is what I added, i didnt do the Year or Semester number on the file, see the attached xlsx file.

Final user wont even know that the Year column is being created in the UI (front-end) unless it creates a new chart / dimension / measure.

• ###### Re: Calculating sales growth

Wow! I have not used script much. Just to import data. But this looks really great!

I think I will have to understand this but it would solve my purpose. Thanks a ton!