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

How to sum one set data from a set of data in another field for charting

I need to sum CountOfOTS_Hist where OTSHist equals late and a count of CountOfOTS_Hist where  OTSHist equals On_Time

I tried sum(if(OTSHist='On_Time',[CountOfOTS_Hist],0)) but it's duplicating everything

DISPOOTSHistCountOfOTS_HistOTS_History
F1BLate925-Mar-19
F1BOn_Time1625-Mar-19
F2BLate425-Mar-19
F3BOn_Time925-Mar-19
F4BLate825-Mar-19
F4BOn_Time1825-Mar-19
F7BLate725-Mar-19
F7BOn_Time925-Mar-19
IC1Late225-Mar-19
IC1On_Time3125-Mar-19
IC2Late1525-Mar-19
IC2On_Time16925-Mar-19
IC3Late425-Mar-19
IC3On_Time8625-Mar-19
IC4Late625-Mar-19
IC4On_Time4525-Mar-19
IC6Late4725-Mar-19
IC6On_Time5825-Mar-19
1 Reply
Vegar
MVP
MVP

Are you certain that you have not duplicated your data in the datamodell? Is your expression correct if you use this expression
sum(CountOfOTS_Hist)
and make a selection in the OTSHist field?

An alternative to If() is to use SET analysis. Try this expression:
sum({<OTSHist={'On_Time'}>}CountOfOTS_Hist)