Skip to content

Instantly share code, notes, and snippets.

@Hugoberry

Hugoberry/Homer.pq

Last active Jun 9, 2017
Embed
What would you like to do?
Prerequisites for drawing Homer Simpson in Power BI. The Power Query code for the iterator table [ranges]
let
//generate a range between [start] and [end] in number of [steps] with a category descriptor
range = (category,steps,start,end)=>List.Accumulate({1..steps},{{category,start}},(s,c)=>s&{{category,start+(c/steps)*(end-start)}}),
//shortcut
pi = Number.PI
//stiching multiple ranges into a an iterator table
in #table(type table[#"fn"=number,#"i"=number],
range(0,20,35*pi,36*pi)&
range(1,10,31*pi,32*pi)&
range(2,10,27*pi,28*pi)&
range(3,30,23*pi,24*pi)&
range(4,30,19*pi,20*pi)&
range(5,30,15*pi,17*pi)&
range(6,30,11*pi,13*pi)&
range(7,30,7*pi,9*pi)&
range(8,30,3*pi,5*pi)&
range(9,30,1*pi,3*pi))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.