Good afternoon Epicor Community!
I’ve created a nice BAQ that summarizes the employee information, including new hires and terminated employees. I’ve created a calculated field (boolean type) that indicates whether an employee was hired in 2023, but am trying to get a count of these values that are true. I’ve tried a few different ways -
-sum(case when PREmpMas.HireDate >= ‘01/01/2022’ AND PREmpMas.HireDate <= ‘12/31/2022’ then 1 else 0 end) over (partition by PREmpMas.Company)
-count(case when PREmpMas.HireDate >= ‘01/01/2022’ AND PREmpMas.HireDate <= ‘12/31/2022’ then 1 else 0 end) over (partition by PREmpMas.Company)
-count(case when HireCount2022 = 1 then 1 else 0 end) over (partition by PREmpMas.Company)
There are a few other ways I’ve tried, but these methods do not return accurate counts, and I can’t understand what the Calculated Field thinks it’s doing, but none are the actual count. I have to do this for 2022 & 2023 Hires and 2022 & 2023 Terms.
I’ve read others solving this through Sub-Queries, but this would take a while. I was wondering if there is a way I can get an accurate count of values = true using a Calculated Field?
Thanks in advance for any suggestions or help your provide!
You could add a Row Number column to the BAQ as a calculated field as follows:
“row_number() over(order by ExtPRPayClass.Description)”
The “Order By” field (“ExtPRPayClass.Description” in the example above) is that field by which the results are sorted. I typically put this field at the start of the table, then click Ctrl End to go to the end of the list and note the last row number, and there’s your count.
Thanks everyone for your suggestions, I learned some new tricks along the way.
I ended up creating 4 additional subqueries that produced the results I was looking for.
My boss was pleased with it, so I appreciate you all helping me get over that hurdle!