Skip to content

Instantly share code, notes, and snippets.

View Power-BI-guy's full-sized avatar

Ben (Power BI Guy) Power-BI-guy

View GitHub Profile
@Power-BI-guy
Power-BI-guy / AutoPopulateMeasureDescriptionsFromOpenAI.csx
Last active April 10, 2024 15:52 — forked from dgosbell/AutoPopulateMeasureDescriptionsFromOpenAI.csx
This is a script for tabular editor that will loop through all the measures in a model and get ChatGPT to write a description of the calculation.
#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";