Hi @jm_pino98 I'm assuming that the variable COSECHA is a numeric, but not a date field. If that's true, you need to convert that into a date field so you can get the year in a date format and then have VA calculate the average percentages by year. You can do this either in the data preparation before the table is loaded into CAS or you can do that within VA using a series of calculations. (I'll include the calculations one at a time to show you the individual steps, but you could combine them to decrease the # of custom calculations.) Then you'd duplicate each of the measures (data items 1, 2, 3, 4, and 5) and change the aggregation to Average.
First, you want to get the year from COSECHA. To do that, you can create a new Calculated Item with this formula: Round(((Cosecha) / (100)),1)
After creating that calculated item (I called it "1 - Year (Category)"), change the Classification from Measure to Category.
Second, get the month from COSECHA. To do that, you create a new Calculated Item with this formula: (Cosecha / 100 - Round('1 - Year (Category)'n, 1)) * 100
Then change the classification to Category.
Third, create Cosecha in a date format using this formula (just set the day to the number 1): DateFromMDY('2 - Month (Category)'n, 1, '1 - Year (Category)'n)
Fourth, get the year as a Date from the new Cosecha date field you just created (be sure to change the format to Float so there are no commas in the displayed value): Year('3 - Cosecha (Date Format)'n)
Here's a screenshot of all those columns in the table with your original data:
Then duplicate the measures and change the aggregation to Average. (If you don't need to display the original values, you could skip the duplication and simply change the aggregation to Average.)
And finally, create your new table using Year and the measures that have the aggregation set to Average.
... View more