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 do I group items together from inside a field and then show their group total?

How do I group items together from inside a field and then show their group total?

8 Replies
Not applicable
Author

Can you attach an example or rephrase?

Not applicable
Author

I have a field called [Metal Type] and I need to show 2 of the metal types as one metal type and their combined tonnage. I have another where I need to combine 4 types and show their combined tonnage.

I am trying IF statements on a chart but I ONLY get -1 in the column.

Not applicable
Author

I am also trying to show the Metal types in 1 column. Column 1 = Metal Types, column 2 = Metal Category, column 3 = Net Good Tons, and column 4 = Gross Tons to Melt. I, currently, get a 5th column labeled 302 where the -1 shows up and everything else is 0s.

Not applicable
Author

Maybe like attached. You would have to use an If() condition and hard-code how you wanna group them.

Thanks

Not applicable
Author

I have tried that but I do not get the tonnage only -1. What am I missing?

IF([Metal Category] = 'IRON' and [Metal Type] <> '60T' or 306 or 'KROMOX' or 'SP1', [Metal Type] = '302')

simenkg
Specialist
Specialist

IF([Metal Category] = 'IRON' and [Metal Type] <> '60T' and [Metal Type] <> '306' and [Metal Type] <> 'KROMOX'  and [Metal Type] <> 'SP1', '302') as [Metal Type]

Not applicable
Author

This will still allow me to show the other Metal Types in this list?

Thanks!

peschu123
Partner - Creator III
Partner - Creator III

Hi James,

doing this in the chart will work fine. I personally don't like complicated expressions in charts.My suggestions assume that there are not too much distinct categories.

Since these categories won't change very often, I would do this in script with

a)

A combination of IF() and match() or wildmatch()

or b) (the easiest one...)

"mapping table"

Create a listbox/tablebox of Column 1 with distinct values --> Export to Excel --> Use Autofilter in Excel and add Metal Category in Column B. (if there is no source available to pull the needed data)

Use mapping load in script to load the Excel Sheet and than use applymap to create Column 2 in script.

Best Regards,

Peter