Skip to content

Instantly share code, notes, and snippets.

@bjulius
bjulius / gist:145a196d4ac94b13b42461a0cfa7aff9
Created June 18, 2023 08:17
M and R Code for Dynamic Trend Stock Cards Using New Card Visual - Brian Julius
let
Source = Web.BrowserContents("https://finance.yahoo.com/quote/NVDA/history?p=NVDA"),
ExtractFromHTML = Html.Table(Source, {{"Column1", "TABLE.W\(100\%\).M\(0\) > * > TR > TH:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(7), TABLE.W\(100\%\).M\(0\) > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(7), TABLE.W\(100\%\).M\(0\) > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(2), TABLE.W\(100\%\).M\(0\) > * > TR > TD[colspan=""7""]:not([rowspan]):nth-child(1):nth-last-child(1)"}, {"Column2", "TABLE.W\(100\%\).M\(0\) > * > TR > TH:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(7) + TH:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(6), TABLE.W\(100\%\).M\(0\) > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(6), TABLE.W\(100\%\).M\(0\) > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(2) + TD[colspan=""6""]:not([rowspa
@bjulius
bjulius / gist:9105b615f06cc2020065c09523f39f55
Created January 10, 2023 23:18
Custom M Function to Create Metadata Summary for Selected Table
(#"Select Table to Create Metadata Summary" as table) =>
let
Schema = Table.SelectColumns(
Table.Schema(#"Select Table to Create Metadata Summary"),
{"Name", "Position", "TypeName", "Kind", "IsNullable"}
),
Profile = Table.Profile(#"Select Table to Create Metadata Summary"),
Join = Table.Sort(Table.Join(Schema, "Name", Profile, "Column"), {"Position", Order.Ascending}),
ReType = Table.TransformColumnTypes(
Join,