Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
User12321
Contributor III
Contributor III

Count in a given year range

Hi,

I have a table with fields Supplier, StartYear and EndYear.

I want to count the number of suppliers based on the max year. 

Any advise please. Thank you.

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

=Concat({<StartYear={"<=2021"}, EndYear={">=2021"}>}Supplier)

View solution in original post

7 Replies
Vegar
MVP
MVP

Try this

Count({<StartYear={">=$(=max(Year))"},  EndYear={">=$(=max(Year))"}>}Supplier)

User12321
Contributor III
Contributor III
Author

Hi @Vegar ,

Your solution is not able to capture those eg. StartYear=2021 and EndYear=2022.

Any other suggestion please.

tresesco
MVP
MVP

May be with OR in set analysis, like:

=Count({<StartYear={'2021'}>+<EndYear={'2021'}>}Supplier)

User12321
Contributor III
Contributor III
Author

Hi @tresesco ,

If my StartYear=2020 and EndYear=2022, will your suggestion still work?

Or do I need to create another column in load with all the years and then see if my max year is inside the years. However, I am not sure how to do this. 

tresesco
MVP
MVP

No need to get all values. We have to just try to understand your logic and then it should be doable, may be like:

=Count({<StartYear={">=2021"}>+<EndYear={">=2021"}>}Supplier)

Which means if either of star and end year is >= then should be counted.

User12321
Contributor III
Contributor III
Author

Hi @tresesco,

StartYear 2022 and EndYear2022 is also being counted. 

What else should I try?

tresesco
MVP
MVP

=Concat({<StartYear={"<=2021"}, EndYear={">=2021"}>}Supplier)