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: 
Not applicable

Calculating Order Share by State by Month and Year

I'm trying to build a chart where I have 3 dimensions: year, month and Revenue (by Order) where the chart shows % of revenue contributed by each state during each month. I know I need to do a Sum(Revenue)/Sum({???} Revenue), but I can't figure out the set variables to use.

1 Solution

Accepted Solutions
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

If you used the "total" correctly, you should be dividing by the sum for that Month only, and the total for the month should always be 1:

total <Year, Month>

The key is to specify your Year and Month dimensions inside the triangular brackets < >

If you post an example, I'll try to show you ...

View solution in original post

4 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

You should have 3 dimensions: Year, Month and State,

and your expression should be:

Sum(Revenue)/sum(total <Year, Month> Revenue)

Not applicable
Author

Thanks Oleg, this gets close, but not quite there. I want to show multiple months on the graph and with this formula, I get the (revenue for each state), divided by (total revenue summed across all months that show on the graph). In other words, each column (month) sums to less than 1 and I want each Month to sum to 1.

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

If you used the "total" correctly, you should be dividing by the sum for that Month only, and the total for the month should always be 1:

total <Year, Month>

The key is to specify your Year and Month dimensions inside the triangular brackets < >

If you post an example, I'll try to show you ...

Not applicable
Author

Thanks Oleg. Your solution was right on, I was accidentally mixing columns between the Dimensions and Expression.