I have a PowerBI Dashboard which, when refreshed, pulls data from Sentinel, and refreshes the data in "Table". When it does this, it removes the existing data, and imports the snapshot (which is limited to a 90 day rolling window - not controlled by me).
Is it possible to convert this query to either merge the new data with the existing table, or append it and then remove duplicates once appended - so that I don't lose "old" data over 90 days old?
This is my query:
= let Source = Json.Document(Web.Contents("https://api.loganalytics.io/v1/workspaces/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxx/query",
[Query=[#"query"="SecurityIncident
| where isnotempty(ClassificationComment)
| project Incident, CreatedTime, CommentTime, AlertName, Alerts, Severity, Status, ClosedTime, Classification, ClassificationReason, ClassificationComment
",#"x-ms-app"="OmsAnalyticsPBI",#"prefer"="ai.response-thinning=true"],Timeout=#duration(0,0,4,0)])),
TypeMap = #table(
{ "AnalyticsTypes", "Type" },
{
{ "string", Text.Type },
{ "int", Int32.Type },
{ "long", Int64.Type },
{ "real", Double.Type },
{ "timespan", Duration.Type },
{ "datetime", DateTimeZone.Type },
{ "bool", Logical.Type },
{ "guid", Text.Type },
{ "dynamic", Text.Type }
}),
DataTable = Source[tables]{0},
Columns = Table.FromRecords(DataTable[columns]),
ColumnsWithType = Table.Join(Columns, {"type"}, TypeMap , {"AnalyticsTypes"}),
Rows = Table.FromRows(DataTable[rows], Columns[name]),
Table = Table.TransformColumnTypes(Rows, Table.ToList(ColumnsWithType, (c) => { c{0}, c{3}}))
in
Table
Thanks, Mark