% Change calculation for Year Over Year QTD doesn't seems to be working


I am trying create a table with multiple segments as row and Current Year QTD Revenue, Prev Year QTD Revenue and % Change in Revenue.


I was able to follow the documentation (https://knowledge.domo.com/Visualize/Adding_Cards_to_Domo/KPI_Cards/Transforming_Data_Using_Beast_Mode/Sample_Beast_Mode_Calculations%3A_Period-over-Period_Transforms)


and Implement beast modes for Current Year QTD Revenue, Prev Year QTD Revenue.


But when I implement 

Ratio: % change between the two using the formula (C/P) - 1

(Case when (quarter(`Datefield`) = quarter(curdate()) and year(`Datefield`) = year(curdate()) and dayofyear(`Datefield`) <= dayofyear(curdate())) then `Amountfield` end / Case when (quarter(`Datefield`) = quarter(curdate()) and year(`Datefield`) = year(curdate())-1 and dayofyear(`Datefield`) <= dayofyear(curdate())) then`Amountfield` end) -1


It doesn't seems to work and am getting blank as % change. Any help would be appreciated.


Note: My data has multiple columns for segmentation and I want to use these 3 beast modes for different segments.