Skip to content

Instantly share code, notes, and snippets.

View PBIQueryous's full-sized avatar
💭
Still queryous 🤓

Imran Haq PBIQueryous

💭
Still queryous 🤓
View GitHub Profile
# Install the MicrosoftPowerBIMgmt module required for managing Power BI resources.
# This module is installed for the current user only, to avoid system-wide changes.
Install-Module -Name MicrosoftPowerBIMgmt -Scope CurrentUser
# Authenticate to the Power BI Service.
# This step is necessary to access and manage Power BI resources.
Login-PowerBIServiceAccount
# Function to retrieve all Power BI workspaces.
# It fetches data from the Power BI API and handles pagination to get all workspaces.
@PBIQueryous
PBIQueryous / movie_trilogy_trellis.json
Created April 6, 2024 21:05
movie_trilogy_trellis
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A faceted chart showing movie ratings across different franchises.",
"transform": [{"calculate": "1", "as": "max"}],
"data": {
"values": [
{"name": "Star Wars", "Film": 1, "Rating": 0.9},
{"name": "Star Wars", "Film": 2, "Rating": 1},
{"name": "Star Wars", "Film": 3, "Rating": 0.8},
{"name": "Indiana Jones", "Film": 1, "Rating": 1},
@PBIQueryous
PBIQueryous / layered_facet_trellis.json
Created April 6, 2024 19:59
layered_facet_trellis
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"name": "trellis_barley",
"description": "Trellis",
"title": {
"text": "Ingressi giornalieri in Terapia Intensiva (TI) a confronto con ricoveri totali in TI",
"color": "#168CC7",
"fontSize": 18,
"anchor": "start",
"font": "Montserrat",
#r "System.IO"
#r "Microsoft.Office.Interop.Excel"
using System.IO;
using Excel = Microsoft.Office.Interop.Excel;
string filePath = @"C:\Desktop\Descriptions"; // Update this to be the desired location of the Descriptions file
string excelFilePath = filePath + ".xlsx";
string textFilePath = filePath + ".txt";
string excelTabName = "ModelDescriptions";
#r "System.Net.Http"
using System.Net.Http;
using System.Text;
using Newtonsoft.Json.Linq;
// You need to signin to https://platform.openai.com/ and create an API key for your profile then paste that key
// into the apiKey constant below
const string apiKey = "<YOUR_API_KEY>";
const string uri = "https://api.openai.com/v1/completions";
const string question = "Please describe this power query code for me:\n\n";
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"usermeta": {
"deneb": {
"build": "1.4.0.0",
"metaVersion": 1,
"provider": "vegaLite",
"providerVersion": "5.4.0"
},
"interactivity": {
@PBIQueryous
PBIQueryous / AutoPopulateMeasureDescriptionsFromOpenAIWithDelay.csx
Created April 6, 2024 03:46 — forked from dgosbell/AutoPopulateMeasureDescriptionsFromOpenAIWithDelay.csx
Update Tabular Model Descriptions from ChatGPT with rate limiting logic
#r "System.Net.Http"
using System.Net.Http;
using System.Text;
using Newtonsoft.Json.Linq;
// You need to signin to https://platform.openai.com/ and create an API key for your profile then paste that key
// into the apiKey constant below
const string apiKey = "<YOUR API KEY HERE>";
const string uri = "https://api.openai.com/v1/completions";
const string question = "Explain the following calculation in a few sentences in simple business terms without using DAX function names:\n\n";
// =====================================
// 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;
@PBIQueryous
PBIQueryous / bump_chart_template
Created April 6, 2024 03:36
BumpChart template
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"usermeta": {
"deneb": {
"build": "1.4.0.0",
"metaVersion": 1,
"provider": "vegaLite",
"providerVersion": "5.4.0"
},
"interactivity": {
@PBIQueryous
PBIQueryous / very_simple_gantt.json
Created March 22, 2024 06:53
Very Simple Gantt
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"width": 500,
"data": {
"values": [
{
"phase": "0",
"name": "Project 1",
"start": "2023-03-01",
"end": "2023-03-15",