How to Obtain the Number of Computers Assigned Multiple Times to Users (Platform Analytics)

segarenc
Tera Contributor

I’m working on a dashboard where I need to create a Single Score widget that shows the percentage of laptops that have been assigned multiple times.

The formula is:

% of Laptops Assigned Multiple Times =
(Number of laptops where Assigned To has changed at least once) ÷ (Total number of laptops) × 100

To achieve this, I think ( not sure) that I need two automatic indicators:

1. Amount of computers that have been assigned multiple times (this is where I’m stuck).

2. Total number of laptops (this one is straightforward).

My idea is to then create a formula indicator that calculates the percentage.

My Questions:

1. How can I create the automatic indicator for computers assigned multiple times?

   - From my research, it looks like I may need to create a scripted automatic indicator, but I’m not sure how to           add the script into the automatic indicator definition. I already wrote some script logic (screenshot     attached), but I don’t know how to plug it in.


2. Is there another easier solution for this use case instead of a scripted indicator?

Any guidance or examples would be really helpful.

Thanks in advance!

6 REPLIES 6

kaushal_snow
Mega Sage

Hi @segarenc ,

 

To calculate the percentage of laptops assigned multiple times using ServiceNow Platform Analytics, follow these steps:

 

  1. Create an Automated Indicator: Define an indicator to count the total number of laptops. This can be done using the Performance Analytics wizard or by scripting, depending on your requirements.
  2. Develop a Scripted Indicator: Write a script to identify laptops that have been reassigned at least once. This involves querying the cmdb_ci_computer table to check for changes in the Assigned To field over time.
  3. Implement Data Collector Scripts: Use data collector scripts to aggregate data over time, ensuring that the scripted indicator reflects historical changes in laptop assignments.
  4. Calculate the Percentage: Create a formula indicator that divides the count of laptops assigned multiple times by the total number of laptops, then multiplies by 100 to get the percentage.
  5. Visualize the Data: Use Performance Analytics widgets to display the calculated percentage on your dashboard, providing insights into laptop assignment trends.

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

Hi @kaushal_snow ,
Thanks a lot for your solution.

Since the Audit History table already captures all changes on the Computer table, I decided to use that approach to avoid complicating things further. For example, whenever a computeris reassigned to a user, the record is logged in the Audit History.

Here’s what I have tried so far:

1. Created a script (not sure if it’s correct for use in a scripted indicator).

segarenc_0-1757101100059.png

2. Set up a data collection (to obtain data periodically).

segarenc_1-1757101181573.png

3. Created an indicator source.

segarenc_2-1757101227720.png


4.Created an automatic indicator and connected it to the script.

segarenc_3-1757101326189.png

 

However, I’m not getting the correct results — so I’m not sure if the issue is with my script or with the way I’ve configured the indicator setup.

A couple of areas where I’d really appreciate your guidance:

In your step 2 (scripted indicator), I wasn’t sure how exactly to query the cmdb_ci_computer table to check for changes in the Assigned To field over time. If possible, could you provide a script example?

In step 3 (data collector scripts), I’m not fully clear on how to implement this. Could you share an example or best practice?

I am a beginner in ServiceNow, so any examples or detailed steps would be really helpful for me to understand.

Bhuvan
Tera Sage

@segarenc 

 

Logic should be fairly simple and can be reused from incident formula indicator '% of open incidents reassigned at least once'

 

Create a field that would track computers that are assigned multiple times similar to incident reassignment counter. Check business rule on task table for reference,

Bhuvan_0-1757085787099.png

Create an automated indicator to track total number of computers and another indicator for tracking computers whose assignment counter is > zero. Create a formula indicator to calculate % of computers assigned multiple times. Below is similar reference from incident table formula indicator,

Bhuvan_1-1757086186600.png

Add the indicator to dashboard and share it with users/groups.

 

If this helped to guide you or answer your query, please mark it helpful & accept the solution. 

 

Thanks,

Bhuvan

Hi @Bhuvan  ,

Thanks a lot for your suggestion. I also thought about creating a counter field (similar to the incident reassignment counter), but unfortunately this approach won’t work  — my colleagues would not accept adding new fields for this purpose.

Since the Audit History table capturing all changes on the Computer  tables.  For example, whenever a laptop is reassigned to a user, the record is logged in the Audit History.

I was able to create two scripts (attached) that return all computers which have been assigned to more than one user. So the logic is working, but the issue I’m facing is that I don’t know how to incorporate this script into an Automatic Indicator.

That’s where I’m currently stuck.