Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
I Have the following data
Country | Year | Vehicles |
Australia | 2024 | 65 |
India | 2023 | 33 |
japan | 2024 | 41 |
Itlay | 2024 | 93 |
Germany | 2024 | 22 |
Uk | 2023 | 34 |
USA | 2024 | 56 |
How can i get count of vehicles added in present year(2024)
can anyone help me with this
All the below would work:
=sum({$<Year={2024}>}Vehicles)
=sum({$<Year={"$(=max(Num(Year)))"}>}Vehicles)
=sum({$<Year={"$(=year(today()))"}>}Vehicles)
Try this: sum({<Year={$(=year(today()))}>} Vehicle)
Try this: sum({<Year={$(=Max(Year))}>} Vehicle)
It is showing the following error
The selections generated no data for this chart
I'm just assuming that you have a field named Vehicle because it looks like it in the image you provided. But maybe you need to change that. And you could also try a simpler solution first, like a hard coded year: sum({<Year={2024}>} Vehicle)
Hi,
Check the data type of Year field whether Numeric or Text format.
If it is text format, Use below expression
sum({<Year={$(=Max(Num#(Year,'####')))}>} Vehicle)
@Muthukumar_77 If it's text format, then that shouldn't work. Probably sum({<Year={'$(=Max(Num#(Year,'####')))'}>} Vehicle) could work (i.e. surround the formula with apostrophes to make it text).
But it's always easier to try hard coded solutions first (2024 or '2024') and then go for a dynamic solution. In this case, @Luffy20 hasn't said anything about what should happen if there is a selection active in the app. Let's say a user has filtered on year 2023 - should the result still be calculated for current year, or the selected year?
All the below would work:
=sum({$<Year={2024}>}Vehicles)
=sum({$<Year={"$(=max(Num(Year)))"}>}Vehicles)
=sum({$<Year={"$(=year(today()))"}>}Vehicles)