Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I got data from this public website into Power query.
https://www.destatis.de/DE/Themen/Wirtschaft/Preise/Verbraucherpreisindex/Tabellen/Verbraucherpreise...
Specifically this table.
In July I pasted the URL as a Websource all the values were displayed.
However at the start of August one more Row "August" was added to the website and Power Query just adds an Empty Row.
As you can see the column on top of July is empty, this is where August needs to be displayed along with the year 2023.
I already tried to change all the [rowspan=""7""] in the M code to ""12"", but it still doesnt work.
I have attached the location to a sample file here with the same source.
Please note that in this file August is included.
The Text file with Advanced Editor code from the error file is inside as well.
https://www.dropbox.com/scl/fo/qho1sxx91usc7zrae135g/h?rlkey=v8bbcwacskq0we35v19ig9nyw&dl=0
I would like to get every all the data as it updates each month in the website.
Would appreciate any help.
Solved! Go to Solution.
Hi @MelvinZ ,
Please try:
let
Source = Web.Page(Web.Contents("https://www.destatis.de/DE/Themen/Wirtschaft/Preise/Verbraucherpreisindex/Tabellen/Verbraucherpreise-12Kategorien.html")),
Data = Source{1}[Data]
in
Data
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @MelvinZ ,
Please try:
let
Source = Web.Page(Web.Contents("https://www.destatis.de/DE/Themen/Wirtschaft/Preise/Verbraucherpreisindex/Tabellen/Verbraucherpreise-12Kategorien.html")),
Data = Source{1}[Data]
in
Data
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
HI @v-cgao-msft ,
Thanks a lot!
It works for the current Month, and the data is much nicer in a table format!
I will only know if new data gets updated at the beginning of next month, but I will mark it as solved anyway. Wish you a nice day!
The issue you're facing with Power Query adding an empty row when a website updates its content can be challenging to handle. This issue typically occurs because the structure of the HTML source on the website has changed, and Power Query is not able to parse the updated content correctly.
To work around this issue and ensure that you get all the data as it updates on the website, you can follow these steps:
1. **Monitor Changes in the Website's Structure**:
Keep an eye on the website's structure and updates. If you notice changes in the structure, such as new rows being added or existing rows being modified, you will need to adapt your Power Query code accordingly.
2. **Use Relative References**:
When you build your Power Query code to extract data from the website, try to use relative references whenever possible. Instead of specifying specific row numbers or HTML tags, use relative references that can adapt to changes in the structure.
3. **Use Data Transformation Steps**:
After importing the data into Power Query, add transformation steps that clean and reshape the data. This can include filtering out empty rows, removing unnecessary columns, and promoting headers. By applying these transformations, you can ensure that your data is consistent and accurate.
4. **Schedule Frequent Data Refresh**:
Set up a regular schedule for data refresh in Power BI. Depending on how frequently the website updates its content, you may need to refresh the data daily, hourly, or at a different interval. This ensures that your dataset stays up-to-date.
5. **Monitor and Adjust**:
Continuously monitor the data refresh process. If you encounter issues like the one you described, investigate the website's structure changes and make adjustments to your Power Query code as needed. You may need to update HTML element references, XPath queries, or other parts of your code.
6. **Handle Errors Gracefully**:
Implement error-handling logic in your Power Query code to handle situations where the website's structure changes unexpectedly. This can include generating warnings or error messages, logging details of the issue, or attempting to recover from the error gracefully.
7. **Consider Web Scraping Tools**:
Depending on the complexity of the website and the frequency of updates, you might also consider using more advanced web scraping tools or libraries that provide greater flexibility and control over data extraction. Some popular options include Python libraries like BeautifulSoup and Scrapy.
Remember that web scraping can be fragile because it relies on the structure of external websites, which can change without notice. Therefore, proactive monitoring and periodic adjustments to your data extraction process are essential to ensure the reliability of your Power BI reports and dashboards.