Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
HarryHacker
Contributor II
Contributor II

How to create a diagram with 3 different fields

Hello Qlik Community,

 

I have Fields like YearMonth (e.g. May19, Jul 19, May 20) and CustomerId (X, Y, Z) and Sales (40.000$, 90.000$, 10.000$).

And now i want to create a diagram which shows me the Customer with the highest Sales and in which Month the Sales was made. For example i made the highest Sales with Customer Y in Jul 19 with 90.000$. 

How can i do this? Can i show two different Fields on the x axis or do i need to make a script in the expression. Can i concatenate or merge some Fields like YearMonth and Customer that i have CustomerYearMonth like for example (CustomerXJul19) and then i can use this field in the diagram with the Sales? 

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

Literally that - YearMonth & Customer. & is for concatenation, so you would get e.g. MayCustomerName1 as your dimension. You can beautify that by concatenating a space, hyphen, or whatever else you want.

View solution in original post

8 Replies
Or
MVP
MVP

I'm not really clear on what exactly you're trying to achieve, but it sounds like you're looking for FirstSortedValue() to get the customer and month and probably something like max(aggr(sum(Sales),CustomerId,YearMonth)) to get the max value.

There should be a lot of similar questions posted with answer, so searching those may help you with more specific information.

HarryHacker
Contributor II
Contributor II
Author

Thank you for your fast response. I tried your solution because it could be the way i want it but i get the error message 'The chart is not displayed because it contains only undefined values'. I have the CustomerId on the x axis and on the y axis i wrote your max(aggr(sum(Sales),CustomerId,YearMonth))

 

Edit: When i have the sorted Sales i want to filter in the settings with how much values should be shown (for example just the first 3). But first of all i need a Chart which has the Sales combined with the CustomerId+YearMonth.

Or
MVP
MVP

Your two requirements appear to be contradictory. You said you're looking for the top combination of month / customer sales, but if that's the case, then a chart with customer and yearmonth as a dimension would be meaningless as only a single value would be returned (there's only one top customer/month combination).

If you're looking for a chart that shows customers and yearmonth and then Top X based on sales, you should be using the "Limitation" option on the chart dimensions.

 

HarryHacker
Contributor II
Contributor II
Author

Yes the second requirement is the one i want. I mean the Top X based on sales. But the Sales should refer to YearMonth and Customer. That i can see the Top 3 Sales are for example 90.000 from Amazon in May19, the second most Sales are 56.000$ from Alphabet in June2020 etc. You know what i mean? But i dont know how i can visualize this. 

Or
MVP
MVP

Sounds like your dimension would be a calculated dimension of YearMonth & Customer, your measure would be Sales, and you'd use the Limitation option for Top X in a bar chart.

HarryHacker
Contributor II
Contributor II
Author

Yes but i am struggling to get the calculated dimension of YearMonth & Customer. Do you have any idea how to get this calculated dimension done?

Or
MVP
MVP

Literally that - YearMonth & Customer. & is for concatenation, so you would get e.g. MayCustomerName1 as your dimension. You can beautify that by concatenating a space, hyphen, or whatever else you want.

HarryHacker
Contributor II
Contributor II
Author

Wow, i am surprised how easy that was. I was thinking about complex aggregation in aggregation... Thanks a lot mate!