Member-only story
Drawing Homer Simpson with DAX trigonometric functions
Recently I started exploring the limits of standard charts in Power BI and ended up drawing all sorts of mathematical functions. For the fun of it, I’ve decided to port a famous Homer Simpson-like curve to DAX and was really impressed by the result.
As always, there is no magic involved, just the usual trio:
- Prepare some iterator ranges in M
- Add some curve functions in DAX
- Visualize it 😍
Depending on how you look at this, the final solution can be summarize into 65 LOC = 15 LOC of M + 2*25 LOC of DAX. But check out the curves on those lines.
The M code
The Power Query code necessary for this doodle, generates some ranges that are specific for drawing various parts of the cartoon figure. For convenience all of them are expressed in units of π.
The DAX code
The DAX code is broken down in 2 measure for X and Y coordinates. Each measure performs two steps: