Skip to content

Instantly share code, notes, and snippets.

View PBI-DataVizzle's full-sized avatar
💭
Shizzle my Vizzle 🤓

Imran Haq PBI-DataVizzle

💭
Shizzle my Vizzle 🤓
View GitHub Profile
@Giammaria
Giammaria / spec.json
Last active December 28, 2023 07:40
20230330_word_wrap
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": {
"text": "A Peek Inside The Mind",
"subtitle": ["of Michael Scott"],
"orient": "top",
"align": "center",
"anchor": "middle",
"fontSize": 22,
"subtitleFontSize": 16
// =====================================
// 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;
@bjulius
bjulius / gist:145a196d4ac94b13b42461a0cfa7aff9
Created June 18, 2023 08:17
M and R Code for Dynamic Trend Stock Cards Using New Card Visual - Brian Julius
let
Source = Web.BrowserContents("https://finance.yahoo.com/quote/NVDA/history?p=NVDA"),
ExtractFromHTML = Html.Table(Source, {{"Column1", "TABLE.W\(100\%\).M\(0\) > * > TR > TH:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(7), TABLE.W\(100\%\).M\(0\) > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(7), TABLE.W\(100\%\).M\(0\) > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(2), TABLE.W\(100\%\).M\(0\) > * > TR > TD[colspan=""7""]:not([rowspan]):nth-child(1):nth-last-child(1)"}, {"Column2", "TABLE.W\(100\%\).M\(0\) > * > TR > TH:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(7) + TH:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(6), TABLE.W\(100\%\).M\(0\) > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(6), TABLE.W\(100\%\).M\(0\) > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(2) + TD[colspan=""6""]:not([rowspa
@Mark-Long-2023
Mark-Long-2023 / Deneb-Donut-KPI.json
Created October 22, 2023 10:49
Deneb-Donut-KPI
{
"data": {"name": "dataset"},
"transform": [
{
"calculate": "datum['Index'] <= datum['_percToShow'] * 100 ? 1 : 0",
"as": "_color"
}
],
"layer": [
{
ONS =
{
("W07000081", "Aberafan Maesteg" ),
("W07000082", "Alyn And Deeside" ),
("W07000083", "Bangor Aberconwy" ),
("W07000084", "Blaenau Gwent And Rhymney" ),
("W07000085", "Brecon, Radnor And Cwm Tawe" ),
("W07000086", "Bridgend" ),
("W07000087", "Caerfyrddin" ),
("W07000088", "Caerphilly" ),
bullet =
// set a percentage for underachieving score
VAR _bad = .5 // set a percentage for sat score
VAR _sat = .75 // target will be 100%
VAR _target = 1 // max width set at 500 in case actual is over 100%
VAR _max_width = 500 // set actual percentage
VAR _actual = 1.2 // figure out ratio for underperforming area
VAR b_ratio = _bad * _max_width // figure out ratio for sat area
VAR s_ratio = _sat * _max_width // figure out ratio for target line
VAR t_ratio = _target * _max_width // figure out ratio for actual and ensure it is not larger than default width of svg
Pie Card =
// set the actual value
VAR _actual = 120
// set the target
VAR _max = 150
// determine the pct
VAR _pct = _actual/_max
5x5 Waffle =
VAR _max = 500
VAR _actual = 120
VAR _waffles = ROUND((_actual/_max) * 50, 0)
VAR _gray = "#7A7979"
VAR _red = "#FF0000"
VAR _header = "data:image/svg+xml;utf8,<svg width=""200"" height=""200"" viewBox=""0 0 200 200"" fill=""none"" xmlns=""http://www.w3.org/2000/svg"">
<rect width=""200"" height=""200"" fill=""white""/>"
VAR _footer = "</svg>"
// white wine dataset used from http://archive.ics.uci.edu/dataset/186/wine+quality
{
"data": {
"name": "dataset"
},
"params": [
{
"name": "grid",
"select": "interval",
@Giammaria
Giammaria / spec.json
Created November 15, 2023 17:45
20231115_faceted_bar_dynamic_labels_vl
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"transform": [
{"filter": "indexof(selectedDepartments, datum['Department']) >=0"},
{"fold": ["Budgeted $", "Paid $"]},
{
"joinaggregate": [
{"op": "min", "field": "value", "as": "min"},
{"op": "max", "field": "value", "as": "max"}
],