Forum Discussion
Service statistic on Page usage
- 2 years ago
Hi again,
When you turn on logging to Log analytics workspace in Power BI it will log almost everything.
You can customize the extract, so it returns exactly what you want. In my project I use this KQL:
PowerBIDatasetsWorkspace
| where TimeGenerated >= startofday(ago(1d)) and TimeGenerated < startofday(ago(0d))
| extend ParsedContext = parse_json(ApplicationContext)
| extend DatasetId = tostring(ParsedContext.DatasetId)
| where isnotempty(DatasetId)
| extend ReportId = tostring(ParsedContext.Sources[0].ReportId)
| extend VisualId = tostring(ParsedContext.Sources[0].VisualId)
| extend UserSession = tostring(ParsedContext.Sources[0].HostProperties.UserSession)
| where isnotempty(UserSession)
| extend DateTime = bin(TimeGenerated, 1m)
| extend Date = format_datetime(TimeGenerated, 'yyyy-MM-dd')
| summarize Sessions = dcount(UserSession) by
Date,
DateTime,
PowerBIWorkspaceId,
PowerBIWorkspaceName,
DatasetId,
ReportId,
VisualId,
ExecutingUser,
UserSession
Then you can connect this to the ActivityEvent API if you like. The KQL returns:
As you can see, this returns one row for each sessionid pr visual id that the end user have visited 🙂 This is just what you want.
Br
Marius
Hi,
I have started on this project myself, and its not strait forward, but doable.
First you need to do is enable logging to Log analytics:
Log analytics fetch the visual id. To map this the correct page you need to use an api to Get report definition:
Im using notebook and a Python script to convert the respons:
"payload": "base64 encoded string
I save this json respons to a file on onelake and Then use a new pythoncript to scan and Get all the visual id and wich page it belongs to.
Then at last I load the kql query from log analytics with the relevant info and map it to the Python extraction in power bi and create a report.
As I said, not Strait forward but doable.
Br
Marius 🙂