# YTD vs LYTD Invoice Count report

**URL:** <https://pug.phocassoftware.com/t/ytd-vs-lytd-invoice-count-report/1094>\
**Category:** Product Ideas\
**Created:** [June 26, 2019, 4:22pm UTC](https://pug.phocassoftware.com/t/ytd-vs-lytd-invoice-count-report/1094 "2019-06-26T16:22:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TravisA](https://avatars.discourse-cdn.com/v4/letter/t/ed655f/32.png) [@TravisA](https://pug.phocassoftware.com/u/TravisA)\
**Post date:** [June 26, 2019, 4:22pm UTC](https://pug.phocassoftware.com/t/ytd-vs-lytd-invoice-count-report/1094/1 "2019-06-26T16:22:04Z")

</div>

Hello,

Does anyone know if there is a way to create a report that shows the Invoice Count by Sales Rep?

Can this report/ chart be a YTD vs LYTD comparison?

I can isolate the value to the bottom right corner of the chart.

---

<div class="post-metadata">

**Author:** ![StuartH](https://sea1.discourse-cdn.com/flex015/user_avatar/pug.phocassoftware.com/stuarth/32/394_2.png) [@StuartH](https://pug.phocassoftware.com/u/StuartH)\
**Post date:** [June 26, 2019, 5:52pm UTC](https://pug.phocassoftware.com/t/ytd-vs-lytd-invoice-count-report/1094/2 "2019-06-26T17:52:24Z")

</div>

We have a measure that is “Total Invoices”, basically it’s a 1 for every unique invoice, presumably its as simple as the first line of each invoice gets a 1, every subsequent line gets a 0.

When it sums it will total the number of unique invoice numbers.

Once thats in the data stream, it’s just a case of using Period Variance or a Custom report to give you a comparison.

I’m not sure how accurate ours is, I didn’t code it 🙂 but it looks about right and my theory above would work if you can replicate it in your export.

---

<div class="post-metadata">

**Author:** ![aaron.roma](https://sea1.discourse-cdn.com/flex015/user_avatar/pug.phocassoftware.com/aaron.roma/32/285_2.png) [@aaron.roma](https://pug.phocassoftware.com/u/aaron.roma)\
**Post date:** [June 26, 2019, 7:45pm UTC](https://pug.phocassoftware.com/t/ytd-vs-lytd-invoice-count-report/1094/3 "2019-06-26T19:45:59Z")

</div>

Phocas doesn’t currently have a good way of doing a count like this on a report. There’s a lot of workarounds, based on some manipulation of your source data like @StuartH mentioned. However most of these also come with some drawbacks. For instance, in Stuart’s example of have above, of having a “1” value for the first line of an invoice… if you then filter the data, say for a particular vendor, that happens to exclude that first line, you’re count is no longer accurate.

---

<div class="post-metadata">

**Author:** ![jason.law](https://sea1.discourse-cdn.com/flex015/user_avatar/pug.phocassoftware.com/jason.law/32/92_2.png) [@jason.law](https://pug.phocassoftware.com/u/jason.law)\
**Post date:** [June 27, 2019, 6:29am UTC](https://pug.phocassoftware.com/t/ytd-vs-lytd-invoice-count-report/1094/4 "2019-06-27T06:29:04Z")

</div>

Hi,

There is an easy way of adding a ‘unique count’ based on document number to a database that doesn’t rely on the ‘put “1” on line one and “0” on the others’ approach.

If you shoot me an email, I’ll happily explain the process; [jason@phocassoftware.com](mailto:jason@phocassoftware.com)

---

<div class="post-metadata">

**Author:** ![DBragg](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@DBragg](https://pug.phocassoftware.com/u/DBragg)\
**Post date:** [July 5, 2019, 5:08am UTC](https://pug.phocassoftware.com/t/ytd-vs-lytd-invoice-count-report/1094/5 "2019-07-05T05:08:02Z")

</div>

Being able to create a “count distinct” measure would be very useful and I was a bit surprised that a BI as powerful as Phocas does not currently have that functionality.
