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
@PBI-DataVizzle
PBI-DataVizzle / dax_dynamic_number_formatting.dax
Created December 27, 2023 15:29
DAX dynamic number formatting
//------- DYNAMIC FORMATTING ---------\\
------------------------------
var _selectedMeasure = SELECTEDMEASURE()
var _digitCount =
IFERROR(
LEN(
CONVERT(
INT( _selectedMeasure ),
STRING )
)
@PBI-DataVizzle
PBI-DataVizzle / table_spec.json
Last active December 28, 2023 15:28
table_spec
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"url": "data/penguins.json"},
"transform": [
{
"window": [
{
"op": "row_number",
"as": "row_num"
}
@PBI-DataVizzle
PBI-DataVizzle / vl_number_formatting_styles.json
Created December 27, 2023 07:42
vl_number_formatting_styles
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"name": "best_number_formatting",
"description": "A simple bar chart with conditional coloring for the highest and lowest values and data labels.",
"width": 450,
"height": 350,
"data": {
"values": [
{"item": "A", "value": 0.8},
{"item": "AA", "value": 98},
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A ranged dot plot that uses 'layer' to convey changing life expectancy for the five most populous countries (between 1955 and 2000).",
"data": {
"values": [
{"country": "China", "year": 1955, "life_expect": 41},
{"country": "China", "year": 2000, "life_expect": 72},
{"country": "India", "year": 1955, "life_expect": 37},
{"country": "India", "year": 2000, "life_expect": 62},
{"country": "United States", "year": 1955, "life_expect": 68},
@PBI-DataVizzle
PBI-DataVizzle / vl_folded_bar.json
Last active December 24, 2023 21:29
vl_folded_bar
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A folded bar chart with data labels showing the grand total of two Products for each category.",
"data": {
"values": [
{"category": "A", "HotDrinks": 28, "ColdDrinks": 20},
{"category": "B", "HotDrinks": 55, "ColdDrinks": 43},
{"category": "C", "HotDrinks": 43, "ColdDrinks": 91},
{"category": "D", "HotDrinks": 91, "ColdDrinks": 81},
{"category": "E", "HotDrinks": 81, "ColdDrinks": 53},
@PBI-DataVizzle
PBI-DataVizzle / spec.json
Created December 24, 2023 21:24
Vega-Lite spec from Sun Dec 24 2023
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A folded bar chart with data labels showing the grand total of two measures for each category.",
"data": {
"values": [
{"category": "A", "HotDrinks": 28, "ColdDrinks": 20},
{"category": "B", "HotDrinks": 55, "ColdDrinks": 43},
{"category": "C", "HotDrinks": 43, "ColdDrinks": 91},
{"category": "D", "HotDrinks": 91, "ColdDrinks": 81},
{"category": "E", "HotDrinks": 81, "ColdDrinks": 53},
@PBI-DataVizzle
PBI-DataVizzle / vl_radial_donut_v1.json
Created December 23, 2023 17:08
vl_radial_donut_v1
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A simple radial chart with embedded data.",
"data": {"values": [12, 23, 47, 52, 19]},
"layer": [
{"mark": {"type": "arc", "innerRadius": 20, "stroke": "#fff"}},
{
"mark": {
"type": "text",
"radiusOffset": 10,
@PBI-DataVizzle
PBI-DataVizzle / vl_bar_labels_cf_minmax.json
Created December 22, 2023 18:01
vl_bar_labels_cf_minmax
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"name": "vl_bar_minmax_avgline_labels_v1",
"description": "A simple bar chart with conditional coloring for the highest and lowest values and data labels.",
"width": 350,
"data": {
"values": [
{"item": "A", "value": 2800000},
{"item": "B", "value": 5500000},
{"item": "C", "value": 4300000},
@PBI-DataVizzle
PBI-DataVizzle / line_graph_datalabels.json
Last active December 22, 2023 13:17
line_graph_datalabels
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Multi-series line chart with labels and highest point markers.",
"width": 400,
"height": 300,
"data": {"url": "data/stocks.csv"},
"transform": [{"filter": "datum.symbol!=='IBM' && datum.symbol!=='GOOG'"}],
"encoding": {
"color": {
"field": "symbol",
@PBI-DataVizzle
PBI-DataVizzle / bar_labels_CF_avgline.json
Last active December 22, 2023 09:54
bar_labels_CF_avgline
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"name": "vl_bar_minmax_avgline_labels_v1",
"description": "A simple bar chart with conditional coloring for the highest and lowest values and data labels.",
"width": 350,
"data": {
"values": [
{"a": "A", "b": 2800000},
{"a": "B", "b": 5500000},
{"a": "C", "b": 4300000},