According to his diary, Nielsen composed the melody on 30 December 1914. It might originally have been intended for the first volume of En Snes danske Viser (1915). For some unknown reason, the melody was only later included in the second volume of 1917. See more about this work at The Royal Library