Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
On the list of things you probably shouldn't be doing with Power BI and DAX, an erupting volcano animation using a Scatter Chart is quite likely extremely high on that list. But oh well, here it is, video and code are below:
Volcano =
VAR __xWidth = 60
VAR __yHeight = 34
VAR __Frames = 18
VAR __Table =
FILTER(
ADDCOLUMNS(
GENERATE(
ADDCOLUMNS(
SELECTCOLUMNS(GENERATESERIES(1,__Frames,1),"Index",[Value]),
"Date",DATE(2023,1,1)+[Index]
),
ADDCOLUMNS(
GENERATE(
SELECTCOLUMNS(GENERATESERIES(1,__xWidth,1),"x",[Value]),
SELECTCOLUMNS(GENERATESERIES(1,__yHeight,1),"y",[Value])
),
"Size",.1,
"Color",
SWITCH(TRUE(),
//explosion
[Index]>.723*__Frames && ( ( [y]>.618*__yHeight && [y]< 2*[Index] && [x] < [y] * 18/14 + .08333*__xWidth && [x]> -18/14 * ([y] - .7167*__xWidth)) ),
TRUNC(RANDBETWEEN(7,10.99)),
//lava flow
[Index]>.556*__Frames && [y]<.647*__yHeight && [y]> 28-[Index] && [x] > [y] * 18/14 && [x]< -18/14 * ([y] - 1.4*__yHeight),
IF(
TRUNC(
RANDBETWEEN(1,[Index]+1)
) < [Index]
&&
TRUNC
(RANDBETWEEN(1,[y])
) > 18-[Index],
3, TRUNC(RANDBETWEEN(7,10.99))
),
//lava boil
[Index]>.334*__Frames && [y] > 21 && [y]<24 && [x]>28 && [x]<33,
IF(TRUNC(RANDBETWEEN(1,2.99))<2,TRUNC(RANDBETWEEN(7,10.99)),1),
//smoke
[Index]>.112*__Frames && ( ([Index]<.778*__Frames && [y]>.618*__yHeight && [y]<(.647*__yHeight)-(1-[Index]) && [x]>.233*__xWidth && [x]<.533*__xWidth && [y]>-14/18*[x]+.75*__xWidth) ),
IF(TRUNC(RANDBETWEEN(1,2.99))<2,5,6),
//sky
[y] > .618*__yHeight || [y] > 14/18 * [x] || [y] > -14/18 * [x] + 1.4*__yHeight,
IF(
TRUNC(RANDBETWEEN(1,40.99))<40 || [y]<.794*__yHeight,1,
IF([Index] < .8333*__Frames, 2, TRUNC(RANDBETWEEN(7,10.99)))
),
//volcano
3
)
)
),
"UniqueKey", FORMAT([Index],"000") * 10000 + FORMAT([x],"00") * 100 + FORMAT([y],"00")
),
[Color] <> 1
)
RETURN
__Table
eyJrIjoiNmYyZGM3YzAtM2Q1Mi00Zjc5LWEzM2ItZDNlZjc0NDk4ZDI4IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9