Skip to content

Instantly share code, notes, and snippets.

@vdvoorder
vdvoorder / PasteBoilerplateDAXQuery.csx
Created October 30, 2025 12:33
Tabular Editor C# script to copy a boilerplate DAX query to clipboard, then paste.
// Tabular Editor C# script to copy a boilerplate DAX query to clipboard, then paste. Written by Ruben Van de Voorde
// Instructions
// ------------
// 1. Save this script as a macro with a context of 'Model'
// 3. Select any DAX Query editor
// 2. Configure a keyboard shortcut for the macro if using Tabular Editor 3
// 4. The script will copy daxQuery to clipboard and paste after 100ms
System.Threading.Thread.Sleep(100);
@vdvoorder
vdvoorder / PreviewData.csx
Last active October 11, 2025 21:37 — forked from data-goblin/PreviewColumnsAndMeasures.csx
A Tabular Editor C# script to preview data for selected tables or columns and measures in the semantic model.
// Tabular Editor C# script to preview data for selected tables, columns and measures. Written by Ruben Van de Voorde, adapted from the original PreviewColumnsAndMeasures.csx by Kurt Buhler (https://gist.github.com/data-goblin/6ff37760cb35b793801c19a6a0ad73b0).
// * For >=1 tables, return row count per table
// * For >=1 columns from the same table, return distinct values and row count per combination
// * For >=1 measures, return the evaluated result per measure
// * For any combination of columns & measures, return distinct values per column combination and evaluated result
// Instructions
// ------------
// 1. Save this script as a macro with a context of 'Table', 'Column' and 'Measure'
// 2. Configure a keyboard shortcut for the macro if using Tabular Editor 3
@vdvoorder
vdvoorder / spec.json
Created December 4, 2024 17:44
VL Patterns_Multiple datasets
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A simple bar chart with embedded data.",
"datasets": {
"somedata": [
{"a": "A", "b": 28},
{"a": "B", "b": 55},
{"a": "C", "b": 43},
{"a": "D", "b": 91},
{"a": "E", "b": 81}
@vdvoorder
vdvoorder / spec.json
Last active December 4, 2024 22:03
Vega-Lite spec from Wed Dec 04 2024
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.20.1.json",
"description": "Lipsum",
"data": {
"url": "https://gist.githubusercontent.com/vdvoorder/7fbe97f6025424bfeb4506f262c4304c/raw/20db48400e8c6c9f14084d7379fd795522dd760b/male-belgian-newborn-names_2013-2023.csv"
},
"encoding": {
"x": {"field": "Jaar", "type": "temporal"},
"y": {"field": "Aantal", "type": "quantitative"},
"strokeDash": {
Voornaam Jaar Aantal
Theo 2024 166
Noah 2013 545
Noah 2014 562
Noah 2015 586
Noah 2016 535
Noah 2017 545
Noah 2018 553
Noah 2019 545
Noah 2020 564
@vdvoorder
vdvoorder / spec.json
Last active September 28, 2024 19:46
Belgian Municipalities
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"projection": {"type": "mercator"},
"layer": [
{
"description": "Shapes of municipalities",
"data": {
"name": "populations",
"url": "https://raw.githubusercontent.com/bmesuere/belgium-topojson/master/belgium.json",
"format": {"type": "topojson", "feature": "municipalities"}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vdvoorder
vdvoorder / spec.json
Created March 11, 2024 19:46
Vega-Lite: stacked line chart with multiple dashed parts
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Hacky way to have multiple dashed parts in single line by layering filtered views. Fork of example 'Line chart with a dashed part' from https://vega.github.io/vega-lite/examples/line_dashed_part.html.",
"data": {
"values": [
{"Date": "1845-01-01", "Value": 28, "Segment": "Doc10", "Attr": "Dead"},
{"Date": "1845-02-01", "Value": 55, "Segment": "Doc10", "Attr": "Dead"},
{"Date": "1845-03-01", "Value": 91, "Segment": "Doc10", "Attr": "Dead"},
{"Date": "1845-04-01", "Value": 81, "Segment": "Doc10", "Attr": "Dead"},
{"Date": "1845-04-01", "Value": 81, "Segment": "Est10", "Attr": "Dead"},
@vdvoorder
vdvoorder / spec.json
Created March 10, 2024 21:16
Vega-Lite: line chart with multiple dashed parts
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Hacky way to have multiple dashed parts in single line by layering filtered views. Fork of example 'Line chart with a dashed part' from https://vega.github.io/vega-lite/examples/line_dashed_part.html.",
"data": {
"values": [
{"a": "A", "b": 28, "series": 1},
{"a": "B", "b": 55, "series": 1},
{"a": "D", "b": 91, "series": 1},
{"a": "E", "b": 81, "series": 1},
{"a": "E", "b": 81, "series": 2},
@vdvoorder
vdvoorder / spec.json
Created March 10, 2024 21:02
Vega-Lite spec from Sun Mar 10 2024-2
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Line chart with a dashed part created by drawing multiple connecting lines. Note that the data source contains the data point at (E, 81) twice.",
"data": {
"values": [
{"a": "A", "b": 28, "predicted": false},
{"a": "B", "b": 55, "predicted": false},
{"a": "D", "b": 91, "predicted": false},
{"a": "E", "b": 81, "predicted": false},
{"a": "E", "b": 81, "predicted": true},