skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Security
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Microsoft 365 + Power BI
    • Dynamics 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Media
      • Retail
    • For analysts
    • For IT
      • Overview
      • Embedded analytics
      • Power BI visuals
      • Automation
      • Documentation
      • Community
    • Overview
    • Find consulting services
    • Partner showcase
    • Find a partner
    • Become a partner
    • Instructor-led training
    • Getting started
      • Overview
      • Online workshops
      • Self-guided learning
      • Webinars
      • Documentation
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Business intelligence topics
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Galleries
    • Community Connections & How-To Videos
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Events
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power BI Community
    • Galleries
    • Quick Measures Gallery
    • Volcano!

    Volcano!

    12-29-2022 12:48 PM

    Super User Greg_Deckler
    Super User
    610 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    Greg_Deckler
    Super User Greg_Deckler
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Volcano!

    ‎12-29-2022 12:48 PM

    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


    @ me in replies or I'll lose your thread!!!
    Instead of a Kudo, please vote for this idea
    Become an expert!: Enterprise DNA
    External Tools: MSHGQM
    YouTube Channel!: Microsoft Hates Greg
    Latest book!:
    Mastering Power BI 2nd Edition

    DAX is easy, CALCULATE makes DAX hard...
    Volcano!.pbix
    Labels:
    • Labels:
    • Other
    Message 1 of 1
    610 Views
    1
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Partners
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    © 2023 Microsoft

    Follow Power BI

    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    California Consumer Privacy Act (CCPA) Opt-Out Icon Your California Privacy Choices