According to my understanding, in your database you have something like the following:
Table Name: Services
machine | date_service(type date)
A | 23/01/2017
B | 03/03/2017
C | 25/02/2017
B | 14/07/2017
In the controller you should have the show method like this:
def show
@services_a = Service.where(:machine => "A").reorder(:date_service)
@services_b = Service.where(:machine => "B").reorder(:date_service)
@services_c = Service.where(:machine => "C").reorder(:date_service)
...
end
and in the view:
<h1>Listing Services</h1>
<table>
<tr>
<th>Maquina</th>
<th>Enero</th>
<th>Febrero</th>
<th>Marzo</th>
<th>Abril</th>
...
</tr>
#A cycle of these for each machine you have
<% @services_a.each do |service| %>
<% if service.date_service.strftime("%m") == "01" %>
<tr><td><%= service.date_service %></td>
<% else %>
<tr><td> </td>
<% end %>
<% if service.date_service.strftime("%m") == "02" %>
<td><%= service.date_service %></td>
<% else %>
<td> </td>
<% end %>
<% if service.date_service.strftime("%m") == "03" %>
<td><%= service.date_service %></td>
<% else %>
<td> </td>
<% end %>
<% if service.date_service.strftime("%m") == "04" %>
<td><%= service.date_service %></td>
<% else %>
<td> </td>
<% end %>
...
<% if service.date_service.strftime("%m") == "04" %>
<td><%= service.date_service %></td></tr>
<% else %>
<td> </td></tr>
<% end %>
<% end %>
<% @services_b.each do |service| %>
<% if service.date_service.strftime("%m") == "01" %>
<tr><td><%= service.date_service %></td>
<% else %>
<tr><td> </td>
<% end %>
<% if service.date_service.strftime("%m") == "02" %>
<td><%= service.date_service %></td>
<% else %>
<td> </td>
<% end %>
<% if service.date_service.strftime("%m") == "03" %>
<td><%= service.date_service %></td>
<% else %>
<td> </td>
<% end %>
<% if service.date_service.strftime("%m") == "04" %>
<td><%= service.date_service %></td>
<% else %>
<td> </td>
<% end %>
...
<% if service.date_service.strftime("%m") == "04" %>
<td><%= service.date_service %></td></tr>
<% else %>
<td> </td></tr>
<% end %>
<% end %>
</table>
Although the code lacks opotimization, it seems to work, and if it fails then that is the idea.
I hope I really serve you.