This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Modules MicrosoftPowerBIMgmt | |
<# | |
.SYNOPSIS | |
This script will move all workspace in one capacity to another capacity | |
.DESCRIPTION | |
.NOTES | |
File Name : Move-PowerBICapacityWorkspaces.ps1 | |
Author : Darren Gosbell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## NOTE: editing your dataset via the XMLA endpoint will prevent you from downloading it | |
## so make sure you have a backup of the original pbix file | |
$clientID = '<your-clientId>' | |
$clientSecret = '<your-client-secret>' | |
$tenantID = '<your-teantId>' | |
$workspaceName = 'Xmla%20Test' | |
$datasetName = 'Role Test' | |
$roleName = 'DynamicRole' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This script will apply an incremental refresh policy to generate | |
## empty partitions for that policy using a Service Principal via the XMLA endpoint | |
$workspace = "XMLA%20Test" | |
$databaseName = "Adv Works Inc Refresh Base" | |
$tableName = "Internet Sales" | |
$clientID = "<Your SPN Client ID>" | |
$tenantID = "<Your TenantID>" | |
$clientSecret = "<Your SPN Secret>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ===================================== | |
// Author: Darren Gosbell | |
// Date: 12 Apr 2023 | |
// This script works in Tabular Editor and sets the MaxParallelismPerQuery | |
// setting at the database level. | |
// ===================================== | |
if (Model.Database.CompatibilityLevel < 1569) | |
{ | |
Model.Database.CompatibilityLevel = 1569; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "System.Net.Http" | |
using System.Net.Http; | |
using System.Text; | |
using Newtonsoft.Json.Linq; | |
// you need to create a resource and deploy a model in Azure OpenAI | |
// to get the following 3 pieces of information | |
// see https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal | |
const string apiKey = "<your API key"; | |
const string resource_name = "<your resource name>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "System.Net.Http" | |
using System.Net.Http; | |
using System.Text; | |
using Newtonsoft.Json.Linq; | |
// You need to signin to https://platform.openai.com/ and create an API key for your profile then paste that key | |
// into the apiKey constant below | |
const string apiKey = "<YOUR API KEY HERE>"; | |
const string uri = "https://api.openai.com/v1/completions"; | |
const string question = "Explain the following calculation in a few sentences in simple business terms without using DAX function names:\n\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "System.Net.Http" | |
using System.Net.Http; | |
using System.Text; | |
using Newtonsoft.Json.Linq; | |
// You need to signin to https://platform.openai.com/ and create an API key for your profile then paste that key | |
// into the apiKey constant below | |
const string apiKey = "<YOUR API KEY HERE>"; | |
const string uri = "https://api.openai.com/v1/completions"; | |
const string question = "Explain the following calculation in a few sentences in simple business terms without using DAX function names:\n\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open the xlsx file and find the DataMashup item | |
$xlPkg = [System.IO.Packaging.Package]::Open($xlFile) | |
$itemParts = $xlPkg.GetParts() | where {$_.Uri -like "/customXml/item*" -and $_.ContentType -eq "application/xml"} | |
foreach ($p in $itemParts) | |
{ | |
$itemStrm = $p.GetStream(); | |
$itemRdr = [System.IO.StreamReader]::new($itemStrm) | |
$content = [xml]$itemRdr.ReadToEnd() | |
$base64 = $content["DataMashup"].InnerText | |
if ($base64 -ne $null) {break;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data.SqlClient; | |
using sysData = System.Data; | |
// Update the following 2 variables for your environment | |
var sqlConnStr = "Data Source=localhost\\sql19;Database=AdventureWorksDW2019;Integrated Security=SSPI"; | |
var isPowerBI = true; | |
// Get all "PBI_Description" column extended Properties | |
SqlConnection conn = new SqlConnection(sqlConnStr); | |
conn.Open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$serverName = 'localhost\tab19' | |
add-type -Path 'C:\Program Files\DAX Studio\bin\Microsoft.AnalysisServices.dll' | |
$server = New-Object Microsoft.AnalysisServices.Server | |
$server.Connect($serverName) | |
$trace = $server.Traces.Add() | |
$event1 = $trace.Events.Add( [Microsoft.AnalysisServices.TraceEventClass]::DiscoverBegin) |
NewerOlder