
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Count values only if they had changed (in compare to the previous row in table)
Hello everyone,
I have a problem with counting some of values - only if value in the previous row was different than in current one.
So for example from 01/06/2019 to 03/06/2019 it should be counted as 4 (4 times the value in customRManuf field has changed in this specific period). I was wondering if peek or previous function would be accurate in here?
I would be really grateful for your support..:)
- Tags:
- count

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where do you want this count? In script in a variable?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there any difference where it will be counted?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There would be differences in approaching the solution. If you want an additional column in the table with the count, you have to script differently (a join would be required), whereas, if you want in variable it is little different without join.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it's gonna work in variable, it can be like that
I just need show in my app this counter as a KPI indicator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try like:
Load *,
If(Peek(Field)<>Field, RangeSum(Peek(Counter),1),Peek(Counter)) as Counter
From <> ;
Let vChangeCount=Peek('Counter')-1;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried with this:
Licznik:
Load reference1,
If(Peek(reference1)<>reference1, RangeSum(Peek(Licznik),1),Peek(Licznik)) as Licznik
Resident FACT_KPI;
Let vChangeCount=Peek('Licznik')-1;
drop Table Licznik;
But it doesn't work ..:/
