IMD SolutionComputing LibraryShop main store

Troubleshooting

Power Chart export shows duplicate history rows

Edge computing and IIoT Published 6 min read

Short answer

A Power Chart export that repeats every stored sample twice is not evidence of double storage. With MinMax pen aggregation and a query interval that holds one stored sample, the minimum and the maximum are that sample, so the chart returns two identical rows per timestamp. Set each pen's aggregateMode to Last Value after a count query on the historian table proves storage holds one row per sample.

On this page
  1. Where the duplicate rows can enter
  2. Why MinMax returns the same row twice
  3. Prove the historian stores one row per sample
  4. Set the pens to Last Value
  5. Counting the rows in an 8-day export at a 5-second sample rate
  6. Which fix fits which case
  7. Questions asked

Two identical rows for every sample in a Power Chart export do not mean the historian stored the tag twice. The chart's export writes exactly what the pen query returned, and a pen whose aggregateMode is MinMax returns two points per query interval: the interval's minimum and its maximum. When each interval holds exactly one stored sample, the minimum and the maximum are that sample, so the file repeats one timestamp with the same value twice. Run a count query on the historian's data table to prove storage holds one row per sample, then set the affected pens to Last Value. On a two-gateway Edge setup syncing tag history to a central SQL historian, neither the gateways nor the sync is the cause.

Where the duplicate rows can enter #

Follow the data from device to file and ask, at each hop, which component writes rows:

  • Edge gateway at each site. Collects and stores tag history locally at its configured rate. It doubles rows only if the same tag is historized twice on one gateway, for example under two history providers.
  • Edge-to-central sync. Forwards history the gateways already stored. It doubles rows only if two sources forward the same tag path.
  • Central gateway to SQL. Writes the historian's tables. This setup has no second gateway and no redundant pair on the same database connection, so no other writer exists there.
  • Power Chart query. Builds one dataset per pen, shaped by that pen's aggregation mode. A MinMax pen returns two points per interval by design.
  • Export. Writes the queried dataset to a file unchanged, from the chart's More button and its Export option.

The first three hops store one sample per interval. The fault lives in the fourth hop, and the fifth reproduces it faithfully into the file.

Why MinMax returns the same row twice #

MinMax divides the requested range into intervals and returns two points per interval: the interval minimum and the interval maximum. The mode earns its keep on dense ranges, where many raw samples fall into one interval and the pair keeps the true extremes visible on a chart a few hundred pixels wide. The duplication appears when the query resolution sits at or near the stored rate, so each interval holds a single raw sample. The minimum of one value is that value, and so is the maximum: the pen returns the same value twice at the same timestamp.

Raw samples in one interval MinMax writes Last Value writes
exactly one two rows, same timestamp, same value one row
many, varying two rows, the true minimum and maximum one row, the last sample only
many, identical two rows, same value one row

On screen the pair is invisible because both points plot on top of each other; the export is the first place anyone reads the dataset row by row. In the eight-day export behind this article, every interval held exactly one stored sample, so every MinMax pair carried the same value at the same timestamp.

Prove the historian stores one row per sample #

Start at the storage layer, before touching any pen property. The historian writes each sample directly to a table in its SQL database, with its quality and a millisecond timestamp, and the data table's default indexes are tagid and t_stamp. For a provider with partitioning disabled the table is sqlth_1_data; with partitioning enabled, run the same count against the partition table that covers the export range.

Look up the numeric tagid that your tag path maps to in the historian's tag tables. The 42 below is an example ID, not a real one:

SELECT tagid, t_stamp, COUNT(*) AS n
FROM sqlth_1_data
WHERE tagid = 42
GROUP BY tagid, t_stamp
HAVING COUNT(*) > 1;

Zero rows back means storage is clean and the duplicates come from the chart. Rows back mean a second writer exists: the tag historized under two providers, two sources syncing one tag path, or a second gateway pointed at the same database. For a string tag, extra rows on quality changes are a different mechanism, and why an Ignition historian string tag stores duplicate rows covers that case.

Keep two readings apart. Rows with the identical timestamp and identical value point at aggregation or a genuine double write. Timestamps milliseconds apart, or values that differ, are two real samples; the millisecond timestamps make that visible.

Set the pens to Last Value #

  1. Open the Perspective view that holds the Power Chart in the Designer and select the component.
  2. In the chart's pen configuration, select each pen that shows the doubled rows and set its aggregateMode property to Last Value.
  3. Do not assume a pen an operator adds at runtime inherits the fix: add one in a session, read its aggregateMode, and correct it if it does not match.
  4. Save, launch a fresh session, and rerun the export over the same range and the same tag.
  5. Check the row count against the prediction in the next section, and spot-check timestamps in the new file against the count query: every timestamp should appear once, carrying the stored value.

The built-in Export writes what the pen query returned, so the mode change is the whole fix. Nothing on the gateways, the sync, or the database changes.

Counting the rows in an 8-day export at a 5-second sample rate #

Inputs, with their units and sources:

  • Stored sample period: 5 s per sample, the rate the historian held for this tag.
  • Export range: 8 days, the range the operator exported.
  • Seconds per day: 86,400 s, from 24 h × 60 min × 60 s.

Rule in words: stored samples over a range equal the range length in seconds divided by the sample period; a clean export holds one row per stored sample; a MinMax export over one-sample intervals holds exactly twice that.

Arithmetic:

  • 8 days × 86,400 s/day = 691,200 s of history
  • 691,200 s ÷ 5 s/sample = 138,240 stored samples per tag
  • 138,240 × 2 = 276,480 rows in the duplicated export

Result: the fixed export should hold about 138,240 rows per tag, against roughly 276,480 before the fix. The prediction assumes the tag historized continuously, with no gaps for shutdowns or commissioning and no suppressed samples.

Decision: a rerun near 138,240 rows confirms the fix, and a count still near 276,480 means a pen still runs MinMax. A count well below the prediction means the tag stored fewer samples than the stored rate predicts. Deadband and compression decide what the historian keeps, and how Tag Historian deadband compression picks stored points explains that count. A file also lands short when the query hits its row limit, which is the same limit that flattens a historian trend.

Which fix fits which case #

What you find What it means What to do
Export repeats every sample identically and the count query returns nothing A MinMax pen queried at one-sample intervals Set that pen's aggregateMode to Last Value and rerun the export
The count query returns rows at shared timestamps A second writer: doubled history provider, two syncs of one tag path, a second gateway on the database Fix the storage configuration first; the pen mode is not the cause
Doubled rows only for one site's tags That gateway's history or sync setup Check the tag's history configuration on that gateway
The trend must keep catching short spikes on multi-day ranges MinMax doing its display job Keep MinMax on screen and pull exports from a raw query instead of the chart's Export

For the case this article started from — a clean storage count, identical timestamp and value, query resolution at the stored rate — the fix is one property per pen, and the row count from the worked example is the confirmation.

Questions asked

Do the Edge gateways or the sync need changing to stop the duplicates?

No. The count query decides this: every timestamp counting one row means the gateways and the sync stored the tag once, and the duplicate pair lives in the chart's pen aggregation. Change gateway or tag history settings only when the count query returns rows at shared timestamps. Then look for one tag historized under two providers, or two sources forwarding the same tag path to the central gateway.

Can I keep MinMax on the chart and still export one row per sample?

Not through the chart's own export: it writes whatever the pen query returned, so a MinMax pen always yields two rows per interval. Keep MinMax for display and pull the file from a query that asks the historian for raw data instead, for example a Tag Historian Query driving a report or a binding. That path ignores the pen modes entirely, so the file holds one row per stored sample.

Does Last Value hide spikes that MinMax would have caught?

Yes, once an interval holds more than one raw sample. Last Value returns only the final sample of each interval, so a short excursion earlier in the interval never reaches the pen or the export. On an export run at the stored rate, every interval holds one sample and both modes return the same values, which is why the choice only matters when the range and the query resolution drift apart.

Keep reading

  • Troubleshooting

    Fix a DeltaV embedded trend that shows no PI history

    The error names the chart's own PI history connection, PI1, failing to open — the data is not missing. Process History View working on the same workstation proves the server, network and stored interval are good, so stop cycling hostname, IP and defaulthost and reconcile the chart's Historical Data Server entry and the PI1 connection definition against the viewer's working path.

    Edge computing and IIoT

  • Troubleshooting

    Fix duplicate driver IDs after a Docker historian upgrade

    Duplicate rows in the historian driver table after a container upgrade mean the gateway identity changed: the data volume or hostname was not carried forward, so the historian opened a new driver ID and logged under it. Pin the volume and hostname, restart the history provider to flush its cached tag IDs, and rebuild the schema only after that. ID jumps of about 1,000 are database sequence caching, not a fault.

    Edge computing and IIoT

  • Troubleshooting

    Why an Easy Chart pen shows no historian data

    A live tag with an empty Easy Chart pen is a historian write-path fault, not a tag fault. Clear the SQL Server no count option first; if it is already off, remove the trigger or procedure statement that makes the update return a result set, then let the store-and-forward cache drain.

    Edge computing and IIoT

Why TLGGetArchiveDataEx returns only OS server data