Skip to main content

Hello, 

I have these data

Area Category Date
Medium  202301
A High 202305
B Medium High 202306
B Medium High 202305
B Medium High 202304
B Medium High 202303
B Medium High 202302
B Medium High 202301
C Low 202306
C Low 202305
C Medium 202304
C Low 202303
D High 202306
D Low 202305
D Low 202304
D Low 202303
E High 202306
E High 202305
E High 202304
E Medium High 202303
E Medium High 202302
E Medium High 202301

I want to count the categories that occurred 3 or more times consecutively per area. 

So something like these

 

Area Category Count Same category consecutively >3
  0
B Medium High 6
C   0
D Low 3
E High 3
E Medium High 3

 

I am not sure how to do it in FME. 

Thank you!

Additional test data:

Area Category Date
F Medium High 202306
F Medium High 202305
F Medium High 202302
F Medium High 202301

Rows 202303 and 202304 are missing, so would this be considered as 3 or more times consecutive occurences?


If the date is not present, it means that no data was registered. So it won’t be considered as consecutive. 


Thanks for your reply. I suspected as much, but there was no example data for this situation.

I'll take a look.


Something like this?

First the workspace adds all missing Area + Date combinations.

Then the consecutive occurences are counted. The AttributeManager uses Adjacent Feature Attributes, the Statistics Calculator gets the maximum values.

Some areas are missing from the results, so they are added in the last step.

 


Funny, I answered a related question of you last week 😃

 


Thank you!

It seems it is what I was looking for. 

Can you maybe send it with an older version of fme? 2022.2

 

 


I've added a FME 2020 version of the workspace to this reaction (as I don't have 2021 or 2022 installed).

By the way, the conditional value using Adjacent Feature Attirbutes looks like this:

 


I am not quite sure about my workspace though. Something like

Area Category Date
A Low 202301
A Low 202302
A Low 202303
A   202304
A   202305
A Low 202306
A Low 202307
A Low 202308
A Low 202309
A   202310
A High 202311
A   202312

will only give

Area Condition Consecutive
A Low 4

but maybe it should return

Area Condition Consecutive
A Low 4
A Low 3

 


I changed the logic of determining the groups of consecutive occurences.

In the case I described above, this workspace returns 

Area Condition Consecutive
A Low 4
A Low 3

 


Reply