Power BI Exchange

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
Expand all | Collapse all

Automate tasks to change all visuals in a pbix file

  • 1.  Automate tasks to change all visuals in a pbix file

    Bronze Contributor
    Posted 22 days ago
    Hi! I need to automate tasks, such as change font, font size, colors, (x, y position, with and height), for many visuals that already exist in the pbix file. Is there a way to perform many tasks with a program like "VB macros in Excel" or some programming tool that enables to handle visuals and measures along all pages ?

    ------------------------------
    Raquel Freud
    System Analyst
    ------------------------------
    Academy - Online Interactive Learning from Experts


  • 2.  RE: Automate tasks to change all visuals in a pbix file

    Top Contributor
    Posted 19 days ago
    The closest you get to that is Power BI Embedded (which you can control via Javascript/Typescript).

    But if you have such a need then that is a sure sign that you may want to dial down on the number of visuals in your report.  Did you know that the Power BI rendering engine can only render five visuals at a time?

    ------------------------------
    Lutz
    ------------------------------

    Academy - Online Interactive Learning from Experts


  • 3.  RE: Automate tasks to change all visuals in a pbix file

    Bronze Contributor
    Posted 17 days ago
    Thank you Lutz for you answer! I will try it. So far, I read I need to have Power BI PRO to use Power BI embedded.

    I have to try...

    I did not know that the rendering engine only renders 5 visuals at a time....... I'm not sure if I understand well what you are trying to say... what does it mean? is it a performance issue? a limitation for embedding in an application? Can I go back to the .pbix file, after editing the visual parameters?
    I want to keep/preserve the visuals as visuals, not as rendered "pixels"


    ------------------------------
    Raquel Freud
    System Analyst
    ------------------------------

    Academy - Online Interactive Learning from Experts


  • 4.  RE: Automate tasks to change all visuals in a pbix file

    Top Contributor
    Posted 17 days ago
    What I am saying (and that is my personal opinion) is that you should focus your efforts on telling the data story, and providing business insights.  That can ALWAYS be done with just a handful of well chosen visuals.  Usually the eye candy is just distracting from the message you want to convey.

    ------------------------------
    Lutz
    ------------------------------

    Academy - Online Interactive Learning from Experts


  • 5.  RE: Automate tasks to change all visuals in a pbix file

    Bronze Contributor
    Posted 16 days ago
    Thank you for your opinion, but it's not related to the question I made at the beginning: I want/need automate some changes in the visuals by programming.

    ------------------------------
    Raquel Freud
    System Analyst
    ------------------------------

    Academy - Online Interactive Learning from Experts


  • 6.  RE: Automate tasks to change all visuals in a pbix file

    Top Contributor
    Posted 16 days ago
    Consider that the .pbix files are actually ZIP archives:
    Extract pbix contents with folder structure.
    in the "Report" folder rename "Layout"  to "Layout.json"
    Do your mass manipulation on the contents of Layout.json with the scripting tool of your choice
    pack everything back into the ZIP archive.

    ------------------------------
    Lutz
    ------------------------------

    Academy - Online Interactive Learning from Experts


  • 7.  RE: Automate tasks to change all visuals in a pbix file

    Bronze Contributor
    Posted 16 days ago
    thank you very much!! I will do it

    ------------------------------
    Raquel Freud
    System Analyst
    ------------------------------

    Academy - Online Interactive Learning from Experts


  • 8.  RE: Automate tasks to change all visuals in a pbix file

    Silver Contributor
    Posted 11 days ago
    Hello Raquel,
    For fonts and colors, you might try "Customize current theme" in "View" menu. If it's not enough you can visit Power BI tips & tricks theme generator :  https://themes.powerbi.tips/. These options are secured and quite easy to use.
    The option to modify the layout file is more tricky.
    1. Reading the Layout.json is quite easy. You might do it with only one click with Power BI Sidetools :  https://thebipower.fr/index.php/power-bi-sidetools/
    2. Writing the Layout.json will corrupt your Pbix. To avoid this, you will need to modify a byte in an other file. Sorry, I don't remember which one but you can search on Internet
    3. Power BI team might change the layout structure at any time
    4. Modifying the Layout.Json is not documented and not supported by Microsoft. It might corrupt the Pbix so be careful
    I don't recommend to modify the Layout.json. Do you know you can select several visuals with the lasso and then modify position and size globally ?
    • typing the position and size values in the "Visualizations" pane if they have the same type 
    • right clicking on visuals and then using "Align" button under the "Format" menu
    You can also take advantage from the "Group" button in  the "Format" menu. Don't forget to check "Display smart guides when visuals are aligned" in the options under "Global / Report settings".
    I hope it helps
    Didier

    ------------------------------
    Didier Terrien
    Group Data Quality Officer
    https://thebipower.fr/
    ------------------------------

    Academy - Online Interactive Learning from Experts