Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate totals for two dimensions?

I have monthly $$ data by industry.  Ultimate goal is to determine top 25 change in percent of total $$, month over month.

So - first figure out industry % of total $ this month, then compare that to industry % of total $ last month.

(Industry $ this month / Total $ this month) - (Industry $ last month / Total $ last month)

The data looks like this:

IndustryPeriod$$
ABCJan 2014100
ABCFeb 2014120
ABCMar 2014110
DEFJan 201450
DEFFeb 201430
DEFMar 201480
GHIJan 2014200
GHIFeb 2014219
GHIMar 2014201

So for Industry ABC:

Feb would be 120/369 = 32.5% (369 is total $ for Feb across industries)

Mar would be 110/391 = 28.1%

28.1% - 32.5% = -4.4% month over month change

Do the same for DEF and GHI, then sort with highest month over month change first.

Ultimately I'd like to show this in a trellis bar chart, with a chart for each industry, $ on the y axis, month on the x axis.

9 Replies
Not applicable
Author

Also - the $$ are summed to get an industry total.  So I'm already calculating SUM($$) to get to the data you see above.  I've tried playing with AGGR and TOTAL with no luck.....

Not applicable
Author

Tina,

you like to select always one month (current) and calculate MOM with previous month of selected, or maybe you prefer to look for top 25 taking into account more months?

Not applicable
Author

We will ultimately look at year over year and quarter over quarter as well, going back many months.  So yes, we would account for more months.

Not applicable
Author

Yes, but many on one chart, or rather chart will be prepared when user selected one month (for example 02-2014) and then you will look for top 25 between 01-2014 and 02-2014?

Not applicable
Author

Ahh - sorry!  I didn't follow your question. The chart will be prepared based on selecting just one month and then looking backwards from there.  Most often we would base this on the current month.

fernando_tonial
Partner - Specialist
Partner - Specialist

hi, see the qvw file.

Sum(Amount) / Sum(TOTAL <Period> Amount)

and

Sum(Amount) / Sum(TOTAL <Period> Amount) - Above(Sum(Amount) / Sum(TOTAL <Period> Amount))

Kind Regards.

Tonial.

Don't Worry, be Qlik.
Not applicable
Author

So,

if you alvays interested in only two months

selected month and selected month - 1 - it is easy with set analysis.

I will try to give you some ideas, but not today .... I have to leave now

regards

Darek

Not applicable
Author

Aha!  Thanks Fernando - this worked.


The final step is to sort the results based on % chg MOM in descending order, because I only want the top 25 % chg in my trellis chart.

I went into the Sort tab, and for the Industry dimension I checked "Expression" and put in the calc for the % chg from prior month.  Not seeing results though - thoughts?

Thanks again - much appreciated.

aveeeeeee7en
Specialist III
Specialist III

Hi

See the Attachment

Regards

Aviral