Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Advanced Filter for Gauge (Aggregated Measure)

New Contributor RB7
New Contributor
Posts: 4

Advanced Filter for Gauge (Aggregated Measure)

Good afternoon,


I am using SAS VA 7.3, and so, I am using the horizontal gauge to display a single value which is "Total Production [MW]".


This single value is grouped (SUM) by the data that is either selected on the graphs or filtered on the control objects. 


However, we have the category "Power Plant" defined as such:


Power Plant 1 - Generator 1

Power Plant 1 - Generator 2

Power Plant 1 (which is the total)

Power Plant 2 - Generator 1

Power Plant 2 - Generator 2

Power Plant 2 - Generator 3

Power Plant 2

Power Plant 3 - Generator 1

Power Plant 3 - Generator 2

Power Plant 3 - Generator 3

Power Plant 3 - Generator 4

Power Plant 3

Total Power Plants


So basically, when I have selected of all of these categories to display on the bar graph (which the client requires) the total is not correct, because it group sums all of the categories, and I want to create and advanced filter on the gauge to basically say:


IF "Power Plant" NotContains "Generator"

RETURN "Power Plant" NotContains "Generator"

ELSE "Power Plant"


This means that if any category's selected are not Generators (which means they are totals) he would ignore the generators values and just SUM the totals. And if there are only Generators selected, he would SUM them up as normal.


I have created that code to no results, it doesn't filter anything.


Is there a way to solve this? Thank you all. 

Occasional Contributor
Posts: 9

Re: Advanced Filter for Gauge (Aggregated Measure)

While I work with the version in 8.1 and 8.2, I assume the logic would remain the same: 


Create a calculated field with the following logic


if <field> not contains "Generator" 

then return <value>

else return missing


Missing can be replaced with 0 if preferred. In 8.1 and 8.2, there is an option to preview your result. Wherein generator exists, the corresponding result would be missing/ 0.  Values would only exist where the string in the condition does not exist. 


Use the calculated field in the gauge. The aggregates of missing/0 values would remain 0, hence giving you the total. 


Note: from what I see, you may also need to put an 'AND' clause to remove values pertaining to Total Power PLant ( to avoid duplication)



Hope this is what you were looking for. 





Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation