Skip to content

Instantly share code, notes, and snippets.

USE [CIGAM]
GO
/****** Object: UserDefinedFunction [dbo].[CGFC_EST_ESTOQUE] Script Date: 4/2/2024 10:14:13 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@gustavoleo
gustavoleo / gist:c9f3049b0c78dae3b72e3e440d291dee
Created February 14, 2024 18:36
CGVW_ME_LISTAR_ITENS_NFE
SELECT RES.Nf,
RES.Serie,
RES.Uni_neg,
RES.Fornecedor,
RES.Id_documento,
RES.Id_item_doc,
RES.Seq_nota,
RES.Cd_Material,
RES.especif1Movimento,
RES.especif2Movimento,
let fnCreateDimTables =
(t as table, optional exclusions as list) =>
let
// Get the schema for the table
Schema = Table.Schema(t),
// Select the text columns
AllTextCols = Table.SelectRows(Schema, each _[Kind] = "text")[Name],
let fnCreateDimID =
(fact as table, col_name as text)=>
let
fnCreateDim = (fact as table, col_name as text)=>
let
removed_cols = Table.SelectColumns(fact,{col_name}),
dedupe = Table.Distinct(removed_cols),
sorted = Table.Sort(dedupe,{{col_name, Order.Ascending}}),
USE [CIGAM]
GO
/****** Object: StoredProcedure [dbo].[MP_SP_INTEGRA_GENESIS_EMPRESA] Script Date: 31/10/2023 09:30:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@gustavoleo
gustavoleo / ExportAllReports.ps1
Last active December 9, 2021 16:43 — forked from Erik-H-zz/ExportAllReports.ps1
Adding Power BI Dataflows
#Log in to Power BI Service
Login-PowerBI -Environment Public
#First, Collect all (or one) of the workspaces in a parameter called PBIWorkspace
$PBIWorkspace = Get-PowerBIWorkspace # Collect all workspaces you have access to
#$PBIWorkspace = Get-PowerBIWorkspace -Name 'My Workspace Name' # Use the -Name parameter to limit to one workspace
#Now collect todays date
$TodaysDate = Get-Date -Format "yyyyMMdd"
@gustavoleo
gustavoleo / py.bat
Created September 18, 2020 17:38
Batch to run Python script from cmd
@echo off
SET RUN_DOTPY=python.exe mercurial.py
SET PYTHON_PATH=C:\dev\Python27
set SCRIPT=
REM Hunt around for python
IF EXIST "python.exe" (
@gustavoleo
gustavoleo / power-query-pagination.m
Created September 14, 2020 18:24 — forked from MarkTiedemann/power-query-pagination.m
Power Query Pagination Example
let
BaseUrl = "https://fake-odata-api.com/v1/Entities?",
Token = "F4K3-T0K3N-D0NT-U5E-L0L",
EntitiesPerPage = 1000,
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
@gustavoleo
gustavoleo / power-query-pagination.m
Created September 14, 2020 18:24 — forked from MarkTiedemann/power-query-pagination.m
Power Query Pagination Example
let
BaseUrl = "https://fake-odata-api.com/v1/Entities?",
Token = "F4K3-T0K3N-D0NT-U5E-L0L",
EntitiesPerPage = 1000,
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
{
"version": "1.0",
"name": "[Tool Name]",
"description": "[Tool Description]",
"path": "C:\\[PATH TO PYTHON EXECUTABLE]\\python.exe",
"arguments": "C:/[PATH TO PYTHON SCRIPT].py \"%server%\" \"%database%\"",
"iconData": "data:image/png;base64,[YOUR BASE64 IMAGE CONTENT]"
}