Forum Discussion

betsyvimal's avatar
betsyvimal
Regular Visitor
8 years ago
Solved

Blinking/Flashing data in power bi

Is it possible to blink or flash data absed on a specific condition.

 

For eg: I am building a report to track status of a bunch of processes. I need to flash a process if its at risk to draw attention. I could sue conditional formatting to display a specific color in such situations but the cocnern is there are large number of processes and a lot of statuses associated. The ones at Risk need immediate attention so a blinking image or icon could help.

 

Is this posible,

8 Replies

  • Hey,

     

    I guess you can use some of the svg data visualizations, you can a more detailed description how to use svg in a table or matrix visual here:

    https://community.powerbi.com/t5/Quick-Measures-Gallery/SVG-Microchart-Harveyball-and-Harveybox/m-p/489599 or here

    https://community.powerbi.com/t5/Quick-Measures-Gallery/SVG-Sparklines-Categorical-Columns/m-p/489533

     

    This measure (don't forget to set the data category to image url):

    dancing donut = 
    var svgChart = 
    "data&colon;image/svg+xml;utf8,<svg 
    xmlns:dc='http://purl.org/dc/elements/1.1/'
       xmlns:cc='http://creativecommons.org/ns#'
       xmlns:svg='http://www.w3.org/2000/svg'
       xmlns='http://www.w3.org/2000/svg'
       width='100%' height='100%' viewBox='-4 -4 8 8'>
     <title>SVG animation using SMIL</title>
     <circle cx='0' cy='1' r='2' stroke='red' fill='none'>
      <animateTransform
       attributeName='transform'
       attributeType='XML'
       type='rotate'
       from='0'
       to='360'
       begin='0s'
       dur='1s'
       repeatCount='indefinite'/>
     </circle>
    </svg>
    "
    return svgChart

    creates a moving donut, basically you can use any animation you can create with pure css/svg.

     

    From my point of view motion should be used sparingly to avoid diverson, but also provides the means to direct attention.

     

    Hopefully this provides you an idea.

     

    Regards,

    Tom

    • Greg_Deckler's avatar
      Greg_Deckler
      Icon for Community Champion rankCommunity Champion

      Here is a blinking dot:

       

      Measure 2 = 
      VAR __color = "Red"
      VAR __radius = 9
      VAR __opacity = 1
      VAR __rand = RAND()
      VAR __header = "data&colon;image/svg+xml;utf8," &
                    "<svg 
                      xmlns:dc='http://purl.org/dc/elements/1.1/'
                      xmlns:cc='http://creativecommons.org/ns#'
                      xmlns:svg='http://www.w3.org/2000/svg'
                      xmlns='http://www.w3.org/2000/svg'
                      width='100%' height='100%'>
                      <title>SVG animation using SMIL</title>"
      VAR __footer = "</svg>"
      VAR __shapeTextCircle = "<circle cx='10' cy='20' r='" & __radius & "' fill='" & __color & "' fill-opacity='" & __opacity & "'> " & "<animate attributeName='opacity' from='1' to='0' dur='1s' begin='0s' repeatCount='indefinite'/></circle>"
      RETURN __header & __shapeTextCircle & __footer
      
      • betsyvimal's avatar
        betsyvimal
        Regular Visitor

        Thank you for the response. Greg.

         

         

        Is there a way you could show me how to use it in a visualization tool? Sorry I am new to Power BI and might be missing a basic information.

        I tried to display it on couple of visualizations but its shows the code within the Measure. I changed the data type to multplie different type but dint help.

    • betsyvimal's avatar
      betsyvimal
      Regular Visitor

      Thank you for the response Tom. I ll take a look at the details you ve shared

  • Hello,

     

    We tried the solutions in this post and found they are more suited to adding lots of shapes as a column in a table.

     

    Great solutions, but we were looking for something slightly different - just making a blinking shape, that responds to changes in data, which can be placed as an object on top of a map. In case anyone is looking for this, I've laid out our method below.

     

    Note that this won't be suitable for some environments; it works in Power BI Desktop with the .pbix file open, which is exactly what we needed. For a published report in the web browser, you will find that the auto refresh rate might be automatically adjusted (particularly if you're not using Premium) and the image won't blink as quickly as this.

     

    1. Define a measure to make a colour change, in response to current time:

    BlinkGreen = calculate(if(mod(second(UTCNOW()),4)>1,"#90ee90","White"))
    The hex code above is equivalent to 'Light Green' if you prefer this.
    This measure will lead to a shape that changes colour (roughly) every 2 seconds.
     
    2. Add your shape / visualisation, e.g.
    - insert -> shapes -> choose your favorite!
    - add e.g. a bar chart or anything that allows conditional formatting
     
    3. Apply conditional formatting, e.g.
    - click on 'fx' button next to Fill or Outline

    - Format by = Field Value; Based on field = BlinkGreen [or whatever you called your measure]

    4. Configure your colours

    - instead of pointing to a fixed hex code as above, you can now point your 'Blink...' measure to alternative measures or column results, so that the blinking colour will respond dynamically to your data. 

    - e.g. we used a 'StatusColour' measure to make some statuses show as green and others red [there's lots of posts on how to do this already]; we then replaced the hex code in the above 'BlinkGreen' measure with this 'StatusColour' measure, to make a 'BlinkStatus' measure

    BlinkStatus = calculate(if(mod(second(UTCNOW()),4)>1,[StatusColour],"White"))

    - tip: when formatting a shape, we used the 'StatusColour' measure for the outline, and 'BlinkStatus' measure as the fill colour - so the outline stays solid but its colour always matches the blinking centre

     

    5. Set auto refresh

    - select the background of your page, go to formatting, set Page refresh = On, set refresh to once per second

     

    You should now have a blinking shape! ðŸ˜¸