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
| Import-Module PSDuckDB | |
| # Start timing | |
| $startTime = Get-Date | |
| # Parameters | |
| $table = "test_table" | |
| $sql = "SELECT * FROM $table" | |
| $output = "Output\QueryResults.csv" | |
| # Create a connection |
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
| // Moving Average | |
| #r "Microsoft.VisualBasic" | |
| using Microsoft.VisualBasic; | |
| using System.Text.RegularExpressions; | |
| // Select a measure | |
| var offsetMeasure = Model.SelectMeasure(); | |
| // Select an offset column |
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
| /* | |
| Benefit: Automatically removes projections from consideration | |
| Make sure Dates[Year] and Dates[Month Name] are on the visual. | |
| Example for a Matrix put these columns in the Rows well in this order | |
| - Year | |
| - Month 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 "Microsoft.VisualBasic" | |
| using Microsoft.VisualBasic; | |
| using System.Text.RegularExpressions; | |
| // Select a measure | |
| var offsetMeasure = Model.SelectMeasure(); | |
| // Select an offset column | |
| string offsetColumn = SelectColumn(Model.Tables["Dates"].Columns.Where( | |
| col => col.Name.Contains("Offset"))) |
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 "Microsoft.VisualBasic" | |
| using Microsoft.VisualBasic; | |
| using System; | |
| using System.Windows.Forms; | |
| string stringInterval = | |
| Interaction.InputBox( | |
| Prompt: "Enter the interval for the moving average:", | |
| Title: "Interval", |
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
| let | |
| // Define the base API endpoint for the Dataverse environment | |
| baseUrl = "https://your-org.crm.dynamics.com/api/data/v9.2/", | |
| // Define the schema name of the environment variable you want to fetch | |
| schemaName = "schema_name", // Replace with the actual schema name | |
| // Fetch the environment variable definition that matches the given schema name | |
| definitionQuery = Web.Contents( | |
| baseUrl, |
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
| let | |
| // Construct the URL to fetch environment variable values | |
| values_url = Env | |
| & "environmentvariablevalues?$select=environmentvariablevalueid,value,_environmentvariabledefinitionid_value", | |
| // Retrieve the environment variable values from the OData feed | |
| values = OData.Feed(values_url, null, [Implementation = "2.0"]), | |
| // Construct the URL to fetch environment variable definitions | |
| definition_url = Env |
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
| ( | |
| // table to pass in | |
| tbl as table, | |
| // name of the date column | |
| date_column as text, | |
| // name of the column you are projecting on | |
| projection_column as text, | |
| // "add", "mul", "None" | |
| trend as text, | |
| // "add", "mul", "None" |
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
| function FormatPQ { | |
| param ( | |
| [string]$code, | |
| [string]$resultType, | |
| [int]$lineWidth = 80, | |
| [int]$indentationLength = 2, | |
| [bool]$includeComments = $true, | |
| [bool]$surroundBracesWithWs = $false, | |
| [bool]$indentSectionMembers = $true, | |
| [int]$alignLineCommentsToPosition = 0, |
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
| Function Set-Folders{ | |
| param ( | |
| [Parameter(Mandatory=$true)] | |
| [string]$BasePath, | |
| [Parameter(Mandatory=$true)] | |
| [string]$ArchivePath, | |
| [Parameter(Mandatory=$true)] | |
| [string]$OutputPath, | |
| [Parameter(Mandatory=$true)] | |
| [string]$WorkspaceName |