View Power BI Python External Tool Sample - NO environment - PowerBIConnectionString.py
This file contains 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 sys | |
print('Power BI Desktop Connection') | |
print(str(sys.argv[1])) | |
print(str(sys.argv[2])) | |
print('') | |
conn = "Provider=MSOLAP;Data Source=" + str(sys.argv[1]) + ";Initial Catalog='';" | |
print(conn) |
View Power BI Python External Tool Sample - NO environment - [tool].pbitool.json
This file contains 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
{ | |
"version": "1.0", | |
"name": "[Tool Name]", | |
"description": "[Tool Description]", | |
"path": "C:\\[PATH TO PYTHON EXECUTABLE]\\python.exe", | |
"arguments": "C:/[PATH TO PYTHON SCRIPT].py \"%server%\" \"%database%\"", | |
"iconData": "data:image/png;base64,[YOUR BASE64 IMAGE CONTENT]" | |
} |
View Power BI Sparkline Column.DAX
This file contains 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
Sparkline Column Categorical Axis = | |
// Static column color - use %23 instead of # for Firefox compatibility | |
VAR BarColor = "%2301B8AA" | |
VAR BarOutlineColor = "%23DDDDDD" | |
VAR BarOutlineWidth = 2 | |
// Obtain number of columns - width generated based on column count (~20 column maximum for bar chart) | |
VAR BarCount = DISTINCTCOUNT('Table'[Customer Segment]) | |
VAR BarWidth = INT(DIVIDE(100,BarCount)) | |
// Obtain overall min and overall max measure values when evaluated for each column | |
VAR YMinValue = MINX(VALUES('Table'[Customer Segment]),CALCULATE([Measure Value])) |
View Power BI Sparkline Line.DAX
This file contains 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
Sparkline Line = | |
// Static line color - use %23 instead of # for Firefox compatibility | |
VAR LineColor = "%2301B8AA" | |
// "Date" field used in this example along the X axis | |
VAR XMinDate = MIN('Table'[Date]) | |
VAR XMaxDate = MAX('Table'[Date]) | |
// Obtain overall min and overall max measure values when evaluated for each date |
View RGBDecimalColorToHex.dax
This file contains 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
RGB Decimal Color to Hex = | |
// Manually enter components of RGB decimal color value, e.g. "RGB(1,184,170)" | |
VAR RedDecimalColorValue = 1 | |
VAR GreenDecimalColorValue = 184 | |
VAR BlueDecimalColorValue = 170 | |
//Decimal to Hex | |
VAR RedPosition0Dec = MOD(RedDecimalColorValue,16) | |
VAR RedPosition0Div = INT(RedDecimalColorValue / 16) | |
VAR RedPosition1Dec = MOD(RedPosition0Div,16) | |
VAR RedPosition1Div = INT(RedPosition0Div / 16) |
View HexColorToRGB.dax
This file contains 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
Hex Color to RGB = | |
VAR HexColorValue = "#01B8AA" | |
// Do not change anything below this line | |
VAR PositionRed1 = RIGHT(LEFT(HexColorValue,2),1) | |
VAR PositionRed0 = RIGHT(LEFT(HexColorValue,3),1) | |
VAR PositionGreen1 = RIGHT(LEFT(HexColorValue,4),1) | |
VAR PositionGreen0 = RIGHT(LEFT(HexColorValue,5),1) | |
VAR PositionBlue1 = RIGHT(LEFT(HexColorValue,6),1) | |
VAR PositionBlue0 = RIGHT(LEFT(HexColorValue,7),1) | |
VAR Red1 = SWITCH(PositionRed1,"A",10,"B",11,"C",12,"D",13,"E",14,"F",15,PositionRed1) * 16 |
View CombineTSVs.ps1
This file contains 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
$getFirstLine = $true | |
get-childItem "[path]\*.tsv" | foreach { | |
$filePath = $_ | |
$lines = $lines = Get-Content $filePath | |
$linesToWrite = switch($getFirstLine) { | |
$true {$lines} | |
$false {$lines | Select -Skip 1} |
View ListAndDownloadAzureBlobContentByPrefix.ps1
This file contains 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
Login-AzureRmAccount | |
$containerName = <<string containing container name>> | |
$storageContext = New-AzureStorageContext -ConnectionString <<connection string to storage account>> | |
$localDestinationPath = <<string containing file system path.>> | |
$blobPrefix = <<string containing prefix to search. wildcard character not needed after prefix.>> | |
#List | |
#Get-AzureStorageBlob -Context $storageContext -Container $containerName -Prefix $blobPrefix |
View RemoveAzureBlobContainerByPrefix.ps1
This file contains 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
Login-AzureRmAccount | |
$containerPrefix = <<string containing prefix to search. wildcard character not needed after prefix.>> | |
$storageContext = New-AzureStorageContext -ConnectionString <<connection string to storage account>> | |
Get-AzureStorageContainer -context $storageContext -prefix $containerPrefix | ForEach-Object {Remove-AzureStorageContainer -context $storageContext -Container $_.Name -Force} |
View ATUS-ActivityLexicon.pq
This file contains 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 | |
FilePath = "[replace with folder path]\tabula-lexiconnoex0315.csv", | |
Source = Csv.Document(File.Contents(FilePath),[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.Csv]), | |
#"Removed Top Rows" = Table.Skip(Source,1), | |
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]), | |
#"Filtered Rows" = Table.SelectRows(#"Promoted Headers", each ([#"Major #(cr)category"] <> "ATUS 2003-2015 Activity coding lexicon" and [#"Major #(cr)category"] <> "Major #(cr)category")), | |
#"Replaced Value" = Table.ReplaceValue(#"Filtered Rows","",null,Replacer.ReplaceValue,{"Major #(cr)category", "First and #(cr)second-tier #(cr)categories"}), | |
#"Filled Down" = Table.FillDown(#"Replaced Value",{"Major #(cr)category", "First and #(cr)second-tier #(cr)categories"}), | |
#"Filtered Rows1" = Table.SelectRows(#"Filled Down", each ([#"6-digit #(cr)activity #(cr)code"] <> "")), | |
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows1",{"", "_1"}) |
NewerOlder