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

Would like to show value as text ('Y') but still have a numeric total

Hello Everyone,

I have a field that can take on the values of 'Y' or NULL.  I would like to show the value of 'Y' in the table, and then for the total, show the Count of the Y's.  I'm not sure how to do that.

 

Below is my dummy data:

Deliveries:
LOAD *,
Timestamp(
	Timestamp#([Stop DateTimeText],'M/DD/YYYY hh:mm:ss tt')
) AS 'Stop Arrival DateTime',
If([ELDLoggedArrivalText] = '-', Null(), [ELDLoggedArrivalText] ) AS 'ELDLoggedArrival',
If([ELDLoggedDepartureText] = '-', Null(), [ELDLoggedDepartureText] ) AS 'ELDLoggedDeparture'
;
LOAD * Inline
[
'Order Number','Stop DateTimeText','City State','Company Name','ELDLoggedArrivalText','ELDLoggedDepartureText'
'255634','2/22/2019 11:20:00 AM','Jacksonville, FL','Loaves of Bread R Us','-','Y'
'255634','2/22/2019 11:30:00 AM','Tampa, FL','BLOCKBUSTER DISTRIBUTION CENTER','Y','-'
'255634','2/22/2019 12:10:00 PM','Jacksonville, FL','Jaguar Center','Y','Y'
'255634','2/22/2019 12:30:00 PM','Chocalate Town, FL','Hersheys','-','Y'
'255634','2/22/2019 1:00:00 PM','Floridaman, FL','County Detention','Y','-'
]
;
DROP FIELDS [Stop DateTimeText], ELDLoggedArrivalText, [ELDLoggedDepartureText]
;
EXIT Script
;

And here is a representation of what I would like to see, with the desired goal in red.

 

SnippyTotal.PNG

 

I've tried switching the 'Y's to '1's and summing that way, but the end users are going to expect to see a 'Y'/'Yes' in the component and not a 1.

 

Any help is greatly appreciated.

1 Solution

Accepted Solutions
Channa
Specialist III
Specialist III

=IF(Count(ELDLoggedArrival)=1,'Y', if(ELDLoggedArrival<>'Y','YES',Count(ELDLoggedArrival)))

 

can you try this

 

see the attach for results

Channa

View solution in original post

2 Replies
Channa
Specialist III
Specialist III

=IF(Count(ELDLoggedArrival)=1,'Y', if(ELDLoggedArrival<>'Y','YES',Count(ELDLoggedArrival)))

 

can you try this

 

see the attach for results

Channa
JustinDallas
Specialist III
Specialist III
Author

Thanks Channa!

My final solution took the form of this, because I wanted to have a Null() where the value wasn't a 'Y'

 

If(Count([Stop Is Departed by TotalMail]) = 1, 'Y', 
	If(Count([Stop Is Departed by TotalMail]) = 0, Null(), 
    	Count([Stop Is Departed by TotalMail])))