Select to view content in your preferred language

Dashboard Indicator with Reference and Advanced Formatting

168
0
03-11-2025 09:42 AM
aprhyde11
Emerging Contributor

I'm needing to add the Estimated, Actual, and Differences for my data in an Indicator.

aprhyde11_0-1741710904884.png

Under the Data tab, I have the Actual Cost set up as a reference to the Estimated Cost. Everything works fine unless the Actual Cost is Null, in that case the Indicator reads "No Data". I need it to read the Estimated Cost: $###, Actual Cost: $0 , and Difference: $0 

This is the expression I'm using:

 

var totalOverall = $datapoint.SUM_TOTAL_OVERALL;  // Your default field
var totalRepairCost = $reference.SUM_TOTAL_REPAIR_COST; // Your alternate field

// If totalRepairCost (actual) is null or empty, set it to 0
var actual = IIf(IsEmpty(totalRepairCost) || totalRepairCost == null, 0, totalRepairCost);

// Round up to the nearest whole number
totalOverall = Ceil(totalOverall);
actual = Ceil(actual);

// Calculate the difference (set to 0 if actual is 0)
var difference = IIf(actual == 0, 0, Ceil(totalOverall - actual));

// Format the numbers with thousand separators
var formattedTotalOverall = Text(totalOverall, '#,##0');
var formattedActual = Text(actual, '#,##0');
var formattedDifference = Text(difference, '#,##0');

return {
  // Text for the "Estimated" value
  topText: 'Estimated: $' + formattedTotalOverall,
  topTextColor: '',
  topTextOutlineColor: '',
  topTextMaxSize: 'medium',
  
  // Only show "Actual" and "Difference" if actual is not 0
  middleText: IIf(actual != 0, 'Actual: $' + formattedActual, ''),
  middleTextColor: '',
  middleTextOutlineColor: '',
  middleTextMaxSize: 'large',
  
  bottomText: IIf(actual != 0, 'Difference: $' + formattedDifference, ''),
  bottomTextColor: '',
  bottomTextOutlineColor: '',
  bottomTextMaxSize: 'x-small',
  
  // Ensure no "No Data" message is shown
  noValue: false
}

 

I realize it's a bit overcomplicated at the moment, but it's working for the most part.

How do I get the Indicator to still show data when Actual Cost = Null?

 

Thanks for the help!

0 Kudos
0 Replies