The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi everyone,
As we know pbix file is collection of different folders which includes the following:
And inside the report folder we have the 'Layout' file (which is a type of JSON file) , the structure is something like (the below Layout file represents a Power BI Report that has two pages and three visuals which include a bar chart, pie chart and a card)
Power BI Report
So I was experimenting whether we can add few visuals from the layout file or modify few attributes of the existing visual (like the fields, or visual aspects like the position, height, width, etc). So I did try the following steps:
1. Created a backup of my test report and then converted the pbix file to a zip (by renaming the extension from '.pbix' to '.zip')
2. Then inside te zip file modified one of the visual aspect of the card on page-2 (height and width)
(Before modifying the height and width the original structure of the card visual)
(To cross check did check in the Power BI report)
So now I modified the value (height and width)
3. Once the changes were made I saved it (to cross check reopened the file the changes were not save even after I overwritten it; So I had to save the modification and save the file as Layout and replace the original one with new one)
4. Then converted the zip back to pbix (even tried with '.pbit') and tried re-opening the report but got
And when I checked for some reasons for this issue (one of them was invalid json structure but before savig the same I had also verified the JSON structure on an online tool and it was fine)
So now I had few questions:
i)That can we update the structure of an existing report by modifying the Layout file.
ii) Is it possible to create a new report if we have the JSON structure: If Yes what are the main components (i.e. mandatory components and which are optional) is there any documentation that can help me in this case
{I did check on Microsoft Co-Pilot about the mandatory components and optional}
So if anyone has any ideas or work-arounds please let me know (as I was trying to accelerate report creation process through code assuming we have a valid JSON structure)
Solved! Go to Solution.
This changes are not supported with pbix or bpit format. They are support with power BI projects. Save your file as pbip and you'll have access to the the report.json file which you can modify. The files should have a JSON schema, so you open with Vs code, you should get a indication of what is valid
This changes are not supported with pbix or bpit format. They are support with power BI projects. Save your file as pbip and you'll have access to the the report.json file which you can modify. The files should have a JSON schema, so you open with Vs code, you should get a indication of what is valid
Hi @Deku ,
Thanks for the guiding to save the file as pbip instead of pbix, after doing this I got the following structure:
Inside the 'Report_Name.Report' folder I got the 'json' file (which you mentioned 'Report.json') which was editable in my editor (VS code)
So I tried modifying the height and width of the card visual on Page-2
(Changed the height and width in the json file-> Saved it), I was expecting the height and width to be updated but the changes weren't reflected.
(Changes not reflected)
Right now I am trying to modifying the existing visuals but if I want to a new visual (lets a donut chart or a table visual) then how should I start the construction is can you help me with this (is there any article or documentation that can help to add a new visual in a report through json file).
Regards,
Sidhant.
Hi @Deku ,
Just a quick update I was able to modify the size of the card visual just had to modify the width ad height in the config section
So now I just want to understand how to add new visuals (and also I have seen a unique id associated with every visual name so how can I figure out the same for other visuals)
Regards,
Sidhant.
With mar release you can right click a visual to copy it's visual id
Hi @Deku ,
Didn't get mar release (is it march release) also on right click I could only see copy visual option
Looks like you need to enable the feature in options
The changes are only seen if you re open the report. Live changes are not supported yet
Can't see any examples online from a quick browse. It is possible. I would turn on git and commit your report. Create a new donut chart or table and look at the git diff to see what changes are applied to your file
Hi @Deku ,
So as per your suggestion I created new report wherein I had two pages: In page-1 -> Placed a Donut chart and in Pge-2: Placed a card visual and a table. So my assumption was the name for visuals will remain same in all reports but that was not the case it is different
(New Report)
(In old report I had two pages: Page-1 -> Barc chart and Pie chart ; Page-2: Card visual)
So I was expecting as in both visuals I have used a card visual on screen-2 the name for the both visuals might be same but when I checked the respective json it was not the case
New Report (TestPlay.pbip -> JSON)
Old Report (Demo_to_Test.pbip-> Json)
So later if I have to add any another visual (there is no fix name associated)
Also in same report I had same visual (with different fields) to see if it also has different name or same name, the answer was different name
(TestPlay.pbip)
(JSON)
Page-2: Card visual name
Page-3:
(Its json)
And once the visual id is identified then comes the question how to structure the query :
(I will compare the reports but if there is an easy way that explains on how to structure it it will be helpful)
Regards,
Sidhant.
Hi @Deku ,
So as per your suggestion I created new report wherein I had two pages: In page-1 -> Placed a Donut chart and in Pge-2: Placed a card visual and a table. So my assumption was the name for visuals will remain same in all reports but that was not the case it is different
(New Report)
(In old report I had two pages: Page-1 -> Barc chart and Pie chart ; Page-2: Card visual)
So I was expecting as in both visuals I have used a card visual on screen-2 the name for the both visuals might be same but when I checked the respective json it was not the case
New Report (TestPlay.pbip -> JSON)
Old Report (Demo_to_Test.pbip-> Json)
So later if I have to add any another visual (there is no fix name associated)
Also in same report I had same visual (with different fields) to see if it also has different name or same name, the answer was different name
(TestPlay.pbip)
(JSON)
Page-2: Card visual name
Page-3:
(Its json)
And once the visual id is identified then comes the question how to structure the query :
(I will compare the reports but if there is an easy way that explains on how to structure it it will be helpful)
Regards,
Sidhant.
Hi @Deku ,
Thanks for the link and your prompt response really appreciate it, also I figured out how to add a visual I just copied one of the visual and pasted it below and for unique name just replaced its few end characters and done
Just wanted to update you on the same
Regards,
Sidhant.