Hi SolarWinds Professionals,
I'm seeking some guidance on a newly created SWQL query for a Modern Dashboard, where I aim to display Custom Poller Data. Query as mentioned below.
==
SELECT
n.NodeID,
n.Caption,
n.IP_Address,
MAX(CASE WHEN AssignmentName LIKE '%avAesTsapiLicenseTotal%' THEN CurrentValue END) AS TotalLicenses,
MAX(CASE WHEN AssignmentName LIKE '%avAesTsapiLicenseAcquired%' THEN CurrentValue END) AS UtilizedLicenses,
CASE
WHEN MAX(CASE WHEN AssignmentName LIKE '%avAesTsapiLicenseTotal%' THEN CurrentValue END) = 0 THEN 0
ELSE
ROUND(
MAX(CASE WHEN AssignmentName LIKE '%avAesTsapiLicenseAcquired%' THEN CurrentValue END) * 100.0 /
MAX(CASE WHEN AssignmentName LIKE '%avAesTsapiLicenseTotal%' THEN CurrentValue END), 2
)
END AS UtilizationPercentag
FROM Orion.NPM.CustomPollerAssignment CP
join Orion.Nodes n on n.NodeID = CP.NodeID
where n.NodeID in (2850)
group by n.NodeID,n.Caption,n.IP_Address
==
The current query is working as expected for most parts. However, I'm facing a challenge in calculating and displaying the available licenses, which should be derived using the formula:
Available Licenses = TotalLicenses - UtilizedLicenses. The screenshot below shows the result based on the current query mentioned above. I would like to add one more column to display the available licenses.

Could anyone please assist me with how to implement this logic in SWQL? I'm struggling to find the correct approach.
Thanks in advance!