renatomitsunami Posted November 6, 2017 Share Posted November 6, 2017 Hi, I'm trying to count distinct rows with a conditional (IF)...example table:CityModelTicketSPHOS1234MTRTO1234SPHOS1234ESRTO5678PEHOS9630SPHOS1234In this script... IF $F{City}="SP" AND $F{Model}="HOS"... count rows where $F{Ticket} is distinct.I have 3 rows but only 1 row distinct (SP/HOS/1234)....Result of variable $V{COUNT_X} = 1.Thanks Link to comment Share on other sites More sharing options...
hozawa Posted November 6, 2017 Share Posted November 6, 2017 I think you'll need to create a sql statement to get the distinct rows. The problem is that you don't have rows sorted by City, Model, Ticket. Link to comment Share on other sites More sharing options...
MiditecReportDev Posted November 7, 2017 Share Posted November 7, 2017 You can do it as follows: Create a variable as you already have and set the "Calculation" to "Distinct Count" - then in the expression fill (in your case) "$F{City} + $F{Model} + $F{Ticket}" - this will result in the Variable printing out the number of unique combinations of these three fields. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now