[Widget Pivot] count distinct

Hello everyone,

I would like to know how I could add a new operation to the widget pivot, since this is the same thing as the native “count” operation in the library, I’m having trouble adding this new operation, cause I don’t have an expected result, since I just do a return of “data.length” I have a total of 16 as result, and when I apply the native count I get 25, I can’t understand why this difference, I would just apply the native operation with a distinct to remove the repeated values? Do you can help me? Thanks you so much in advance

Hello @bdasilva ,
As far as I can see, it works as expected: Code Snippet
If at all possible, could you please provide an isolated example where the issue can be seen (using our Snippet Tool)?

Hello @annazankevich,

I’ve solved my problem, but if you want I can explain to you what was happening, and maybe you can even assess if there is something better to adapt to the correction I made, etc.

So, I needed to remove all invoice numbers (for example) that already exist in both the cell and the column too, take at look in my solution : Code Snippet

Note: I really needed to create a variable to store the values of the children of all cells, knowing that this function (addOperation) is called recursively

if you open the console you will see the result stored within this variable, you will notice that in the month of January the same number was repeated for another cell (indexed in 6 and 7, value=34990), in this case I avoided counting it

NOTE: the new operation called “cdt” was built to make a count distinct.