Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating percentage share of total value

Hello experts,

    I'm working on app where I'm suppose to display a table 3 columns

promotion category, number of sales for category and percentage of sales for each category (This will add to 100% for all categories.).

There could be sales that does not belong to any of the promotion categories. There are additional filters to fileter on year, month, region etc.

I was not able to write formula to calculate percentage of sales for each category. Please advice me on this.

Thanks,

krishna

5 Replies
Not applicable
Author

Krishna,

Try this:

sum(total <promotion_category> sales)/sum(sales).

Regards,

Kiran.

Not applicable
Author

Thanks Kiran.

Problem with the formula is that when Sum(sales) , this will get all sales including those that does not belong to any category.

I need percentage of sales for each category within the promotion sales only. ( excluding non-promotional sales).

Not applicable
Author

Hi Krishna,

you could use Set analysis sum(${<[promotion_category] = {'*category*}>}sales)/sum(sales).

Not applicable
Author

Add set analysis on promtion category to filter null values {<promotion_category-={''}>}. Actually in my expression numerator and denominator should be interchanged.

Kiran.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If [Promotion Category] is a dimension in your chart, the expression would be:

sum(Sales) / sum(TOTAL Sales)

-Rob