This file contains hidden or 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
library(tidyverse) | |
library(patchwork) | |
library(ggtext) | |
# Create the data frame | |
df <- data.frame( | |
category = c( | |
"Machine sales", "Accessories sales", "Sales", | |
"Cost of sales", "Gross profit", "R&D costs", | |
"Sales costs", "Administration costs", "Net income" |
This file contains hidden or 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
## Add imports | |
library(tidyverse) | |
## Configuration | |
options(warnPartialMatchDollar = TRUE) | |
## Define functions | |
## Pre-built utility functions |
This file contains hidden or 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
# This code creates an example Nested Column Chart of the type developed by Brittany Rosenau | |
# this code will produce the graphic below if you paste it into R Studio and run it | |
# to run it in a Power BI R visual, just import the csv into Power Query | |
# and then paste in the code below, changing df <- dataset | |
# note that "dataset" is the variable name used by convention in Power BI to call the table | |
# resulting from the previous step | |
# Load necessary libraries | |
library(ggplot2) | |
library(dplyr) |
This file contains hidden or 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
# Load necessary libraries | |
library(ggplot2) | |
library(dplyr) | |
library(tidyr) | |
library(gridExtra) | |
library(grid) | |
# Create the dataframe with the data from the image | |
sales_data <- data.frame( | |
Country = c("Finland", "Finland", "France", "France", "Netherlands", "Netherlands", |
This file contains hidden or 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 | |
Source = " | |
import os | |
import openai | |
import pandas as pd | |
openai.api_key = os.getenv(""OPEN_AI_POWER_QUERY_API_KEY"") | |
response = openai.Model.list() | |
df = pd.DataFrame(response['data']) | |
", | |
RunPyScript = Python.Execute(Source), |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Moving Average Slider</title> | |
<style> | |
.slider-container { | |
display: flex; | |
align-items: center; |
This file contains hidden or 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
// C# script for Tabular Editor to document DAX measures using Claude 3.7 Sonnet API | |
// This script generates explanations for DAX measures and places the resulting info in the measures' metadata Description field | |
// Authored by Brian Julius, Feb 2025 | |
#r "System.Net.Http" | |
#r "Newtonsoft.Json.dll" | |
#r "Microsoft.VisualBasic" | |
using System; | |
using System.Linq; | |
using System.Net.Http; |
This file contains hidden or 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
BIM Info = | |
VAR TableInfo = | |
ADDCOLUMNS ( | |
INFO.VIEW.TABLES (), | |
"Component", "Tables" | |
) | |
VAR ColumnInfo = | |
ADDCOLUMNS ( | |
INFO.VIEW.COLUMNS (), | |
"Component", "Columns" |
This file contains hidden or 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
I had Deepseek R1 write the code for this solution, based on the following prompt: | |
Write M code that calls an R Script that uses a regex via the Stringer package to extract the dates in standard dd/mm/yyyy format from the left column. In the source column the year is specified first, then the month, then the day. Ignore any time values |
This file contains hidden or 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
//Created by Brian Julius, 23 Oct 2024 using AI model o1-P | |
BulletChartSVG = | |
VAR __TotalSales = [Total Sales] | |
VAR __TargetSales = [Current Year Sales Target] | |
-- Normalize the bars by using the maximum target sales across all data | |
VAR __MaxTargetSales = [Max Sales Target] | |
-- Scale the bars based on the maximum target sales |
NewerOlder