Skip to content

Instantly share code, notes, and snippets.

View michaelbrylka's full-sized avatar

Michael Brylka michaelbrylka

View GitHub Profile
@michaelbrylka
michaelbrylka / powerbi-m-processmining-variants.txt
Last active April 27, 2023 19:35
Power Query transformations to create event traces
/* sample from the Power Query M script */
let
[...]
/* for correct event traces the proper order of the event log is essential */
/* the log is sorted by process key and activity start time both in ascending order */
#"Sorted rows" = Table.Sort(#"Result from previous step",{{"process_key", Order.Ascending}, {"activity_start", Order.Ascending}})
/* column for grouping process_key */
/* aggregation type: Text.Combine concatenates all activity keys separated by hyphens for a given process key */
#"Event trace" = Table.Group(#"Sorted Rows", {"process_key"}, {{"Event Trace (without dup)",
each Text.Combine([activityid.activity_key], "-"), type nullable number}, {"Event Trace (without dup) desc",
@michaelbrylka
michaelbrylka / install-modules.ps1
Created July 8, 2022 09:04
Necessary PowerShell modules for deployment
Install-Module -Name MicrosoftPowerBIMgmt -Scope Currentuser -Force
Install-Module -Name newtonsoft.json -Scope Currentuser -Force
@michaelbrylka
michaelbrylka / deploy-report-prod.ps1
Last active July 8, 2022 09:08
PowerShell script for deployment of a Power BI report on stage production
$pwsec = "$(clientsecret)" | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList $(clientid), $pwsec
$workspace = '$(workspaceid)'
$filepath="$(System.DefaultWorkingDirectory)/_pipeline/$($env:FILEPATHREPORT)/report/"
$reportname="$($env:REPORTNAME)"
$datasetname="$($env:DATASETNAME)"
$filename="$($env:REPORTNAME).pbix"
Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId $(tenantid);
@michaelbrylka
michaelbrylka / deploy-report-dev.ps1
Last active July 8, 2022 09:08
PowerShell script for deployment of a Power BI report on stage development
$reportname = $env:REPORTNAME
$pwsec = "$(clientsecret)" | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList $(clientid), $pwsec
$workspace = '$(workspaceid)'
$filepath="$(System.DefaultWorkingDirectory)/_pipeline/$($env:FILEPATHREPORT)/report/";
$filename="$($env:REPORTNAME).pbix";
Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId $(tenantid);
New-PowerBIReport -Path "$($filepath)$($filename)" -Name "$($reportname)" -WorkspaceId $workspace -ConflictAction CreateOrOverwrite;
@michaelbrylka
michaelbrylka / deploy-dataset-prod.ps1
Last active July 8, 2022 09:07
PowerShell script for deployment of a Power BI dataset on stage development
$pwsec = "$(clientsecret)" | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList $(clientid), $pwsec;
$workspace = '$(workspaceid)';
$filepath="$(System.DefaultWorkingDirectory)/_pipeline/$($env:FILEPATHREPORT)/dataset/";
$reportname="$($env:REPORTNAME)"
$datasetname="$($env:DATASETNAME)"
$filename="$($env:DATASETNAME).pbix"
Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId $(tenantid);
@michaelbrylka
michaelbrylka / deploy-dataset-dev.ps1
Last active July 8, 2022 09:08
PowerShell script for deployment of a Power BI dataset on stage prodction
$datasetname = $env:DATASETNAME
$pwsec = "$(clientsecret)" | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList $(clientid), $pwsec
$workspace = '$(workspaceid)'
$filepath="$(System.DefaultWorkingDirectory)/_pipeline/$($env:FILEPATHREPORT)/dataset/";
$filename="$($env:DATASETNAME).pbix";
Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId $(tenantid);
New-PowerBIReport -Path "$($filepath)$($filename)" -Name "$($datasetname)" -WorkspaceId $workspace -ConflictAction CreateOrOverwrite;