Skip to content

Instantly share code, notes, and snippets.

let func =
let
ListDateImpl =
(From as date, To as date, Selection as text ) =>
let
// Create default-value "Day" if no selection for the 3rd parameter has been made
TimeInterval = if Selection = null then "Day" else Selection,
@nickchobotar
nickchobotar / Table.CreateAmortization.pq
Created March 21, 2018 04:04 — forked from tonmcg/Table.CreateAmortization.pq
M Language Finance & Accounting Functions
let
Table.CreateAmortization = let
AmortizationFunction = (initialAmount as number, interestRate as number, numberOfPeriods as number, periodicity as text, optional date as any, optional balloonPayment as number) as table =>
let
CompoundingPeriods = {"Daily", "Monthly", "Quarterly", "Semi-annual", "Annual"},
CompoundingMap = {{"Daily",365}, {"Monthly",12}, {"Quarterly",4}, {"Semi-annual",2}, {"Annual",1}},
CompoundingPeriod = List.First(List.Select(CompoundingMap, each _{0} = periodicity)){1},
Balloon = if balloonPayment is null then 0 else balloonPayment,
PeriodicInterest = interestRate / CompoundingPeriod,
TotalPeriods = numberOfPeriods * CompoundingPeriod,
@nickchobotar
nickchobotar / closureExample.ts
Created April 27, 2018 06:00 — forked from Hugoberry/closureExample.ts
[Power Query] Closures, partial application and cascading parameters
let
addTo = (x) => (y) => x + y,
//make a closure with scope x=5
addToFive = addTo(5),
//becomes addTo(5) => (y) => 5 + y
eight = addToFive(3)
in //becomes addTo(5) => (3) => 5 + 3
eight
@nickchobotar
nickchobotar / dotnetlayout.md
Created April 24, 2019 05:12 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@nickchobotar
nickchobotar / 00-intro.md
Created May 3, 2020 01:10 — forked from mdo/00-intro.md
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@nickchobotar
nickchobotar / mdstyles.css
Created December 10, 2020 04:33 — forked from tr00st/mdstyles.css
Dark colour scheme for MarkdownEditor (https://github.com/madskristensen/MarkdownEditor)
/*
* Dark colour scheme for MarkdownEditor (https://github.com/madskristensen/MarkdownEditor)
*
* Licensed under MIT license.
*
* Copyright (c) 2018 James Cheese
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights