Skip to content
Advertisement

Arranging data by year and proportion

I have one table with the following format:

Note 1: [End_Date = NULL] means that participation has not ended. [Proportion = NULL] means that participation is 0.

Output: I want to have the proportion of each sub_entity for every active year.

Note 2: One Sub_Entity can be a proportion of different Entities.

The final table will be something like:

Note 3: I used points to denote years in between that range.

Advertisement

Answer

Try this Regressionist:

Explanation:

gives me number between 0 and 99. With the cross join I add those number to every year in the START_DATE as long as START_DATE + (0..99) doesnt exceed END_DATE or the current year is END_DATE is null.

Hope its a little clearier!

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement