Skip to content

Instantly share code, notes, and snippets.

@Hugoberry
Last active May 21, 2023 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hugoberry/6cf0ef9c2c1e3112261b359903dbd857 to your computer and use it in GitHub Desktop.
Save Hugoberry/6cf0ef9c2c1e3112261b359903dbd857 to your computer and use it in GitHub Desktop.
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))
@ChrisTomanek
Copy link

ChrisTomanek commented May 21, 2023

Would you be able to share the PBIX file? I have an issue with PQ implementation of that code?

@ChrisTomanek
Copy link

image
this is what I'm trying to develop in PBI, and it seems the way you have implemented the function curve might help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment