Error: 'CALCULATE' has been used in a True/False expression on YTD SWITCH/TRUE Logic

Viewed 27

I am trying to wrote logic to show the Year to Date values on a P&L alongside in month values. The logic below works on the monthly calculations but an error is being received when adding in logic to attempt to show the YTD values at the end of the statement.

Selected YTD Actuals = 
VAR CURRENTITEM = SELECTEDVALUE( 'P&L Template'[Items (Normalized)])
 return 
 SWITCH( TRUE(),
  CURRENTITEM = "Total Staff Costs", [YTD Total Staff Costs],
  CURRENTITEM = "Total Other Overheads", [Total Other Overheads YTD],
  CURRENTITEM = "Total Spend", [Total Spend YTD],
  CALCULATE(CALCULATE([YTD Cost], FILTER( 'Transaction Data', 'Transaction Data'[CATEGORY] = CURRENTITEM), CALCULATE ([Total Cost], FILTER('Transaction Data', DATESYTD (Dates[Date]))))))

Any idea on how to resolve the calculate expression error above?

Appreciate any help,

Bruce

0 Answers
Related