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
| Web.InvokeWebService.InvokeWebService Url: $'''https://api.github.com/repos/cbaragao/PQ-Shared-Library/git/trees/main?recursive=1''' Method: Web.Method.Get Accept: $'''application/json''' ContentType: $'''application/json''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: True UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False TrimRequestBody: True ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode | |
| Variables.ConvertJsonToCustomObject Json: WebServiceResponse CustomObject=> GithubResponse | |
| Variables.CreateNewDatatable InputTable: { ^['Path', 'URL'], [$'''''', $''''''] } DataTable=> GH | |
| LOOP FOREACH tree IN GithubResponse.tree | |
| Variables.AddRowToDataTable.InsertItemToDataTable DataTable: GH RowIndex: 1 RowToAdd: [tree.path, tree.url] | |
| END | |
| Variables.FilterDataTable DataTable: GH Filt |
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
| SET PQ TO $fx'=Substitute(Code,Char(34),Concatenate("`", Char(34)) )' | |
| Scripting.RunPowershellScript.RunPowershellScript Script: $fx'function FormatPQ { | |
| param ( | |
| [string]$code, | |
| [string]$resultType, | |
| [int]$lineWidth = 80, | |
| [int]$indentationLength = 2, | |
| [bool]$includeComments = $true, | |
| [bool]$surroundBracesWithWs = $false, | |
| [bool]$indentSectionMembers = $true, |
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
| // get the outliers using quartiles | |
| quartile_outliers = | |
| LAMBDA(top_or_bottom, q, iqr, | |
| IF( | |
| LOWER(top_or_bottom) = | |
| "top", | |
| q + (1.5 * iqr), | |
| q - (1.5 * iqr) | |
| ) | |
| ); |
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 | |
| fnGetSQLServer = | |
| let | |
| GetSQLServerType = type function ( | |
| server as ( | |
| type text | |
| meta [ | |
| Documentation.FieldCaption = "Server Name", | |
| Documentation.FieldDescription = "SQL Server name", | |
| Document.SampleValues = {"SERVER"}, |
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 Power BI Parameter for Environment URL (Create this in Power BI) | |
| EnvironmentURL = "yourorg.crm.dynamics.com", // Can be a Power BI parameter | |
| // Connect to Dataverse (STATIC connection) | |
| Source = CommonDataService.Database(EnvironmentURL, [CreateNavigationProperties = null]), | |
| // Define Power BI Parameter for SQL Query (User-defined in Power BI) | |
| SQLQuery = "SELECT * FROM systemuser", // Replace with your query |
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 | |
| x=1, | |
| y=2, | |
| z=3 | |
| in | |
| z |
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
| #change this to your desired file path and name | |
| $xlfile = "$env:temp\dax2.xlsm" | |
| Remove-Item $xlfile -ErrorAction SilentlyContinue | |
| $Excel = ConvertFrom-Csv @" | |
| Here is your file, | |
| "@ | Export-Excel $xlfile -PassThru -AutoSize | |
| $wb = $Excel.Workbook | |
| $sheet = $wb.Worksheets["Sheet1"] |
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 | |
| Switch = Function.From( | |
| type function (value as any, l as list, default as any) as any, | |
| (params) => | |
| let | |
| // Function to select nth item of list | |
| // If you pass in zero, you get even indices | |
| // If you pass in one, you get odd indices | |
| fnSelectEvenOdd = (lst as list, remainder as number) as list => | |
| let |
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
| (str as text, optional keep_upper as logical, optional keep_lower as logical, optional keep_nums as logical, optional keep_specials as logical, optional keep_chars as text) => | |
| let | |
| // Function to remove characters from the string | |
| fnRemove = | |
| (string as text, l as list)=> | |
| Text.Combine( | |
| List.Select( | |
| Text.ToList(str), | |
| each List.Contains(l, Character.ToNumber(_))=false | |
| ), |