Forum Discussion
Getting SharePoint List items with full history version?
please share how do we apply schedule refresh on this dynamic data source,
Hi Anonymous,
I suggest you to read these articles:
- Setting a scheduled refresh on a Dynamic Data Source in Power BI
- Web.Contents(), M Functions And Dataset Refresh Errors In Power BI
- Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code
To set a scheduled refresh using dynamic data source, I've edit the function of JensG in this way:
let
Source = (VersionsRelevantSharePointListName as text, VersionsRelevantSharePointLocation as text, VersionsRelevantItemID as number) => let
Source = Xml.Tables(Web.Contents(
"https://YourAddress.sharepoint.com/sites/",
[RelativePath = VersionsRelevantSharePointLocation & "/_api/web/Lists/getbytitle('" & VersionsRelevantSharePointListName & "')/items(" & Text.From(VersionsRelevantItemID) & ")/versions"]
)),
entry = Source{0}[entry],
#"Removed Other Columns2" = Table.SelectColumns(entry,{"content"}),
#"Expanded content" = Table.ExpandTableColumn(#"Removed Other Columns2", "content", {"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"}, {"content"}),
#"Expanded content1" = Table.ExpandTableColumn(#"Expanded content", "content", {"properties"}, {"properties"}),
#"Expanded properties" = Table.ExpandTableColumn(#"Expanded content1", "properties", {"http://schemas.microsoft.com/ado/2007/08/dataservices"}, {"properties"})
in
#"Expanded properties"
in
Source
3 parameters are required for the function:
- VersionsRelevantSharePointLocation => The subdirectory of your SharePoint site (is what come after ...sites/)
- VersionsRelevantSharePointListName => Your SharePoint List Name
- VersionsRelevantItemID => SharePoint list item ID
Then, once you have published your report into Power BI service, I raccomend to read these articles:
- [Unable to combine data] accessing data sources that have privacy levels
- Information is needed in order to combine data
Hope this may help you.
Bye!
- Anonymous4 years agoNot applicable
THANKS A LOT, ❤️ YOU SAVED MY DAY 🙂 YOUR ABOVE CODE WORS FINE
- harsh_bi_dev3 years agoFrequent Visitor
Hello mzzwtr ,
Thanks for this answer. I'm facing an issue with the solution you provided in Power BI Service as below.Please know that it is working fine in the Power BI Desktop but not on Power BI Service.
Please help me out with this.
- mzzwtr3 years agoRegular Visitor
Hi harsh_bi_dev ,
could you show me how you connected the SharePoint Online List data source to your Power BI dashboard?
I followed this guide:
https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-sharepoint-online-list
Another question, could you show me what steps you took to publish your Power BI dashboard into your Power BI Service workspace?
I followed this guide:
https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-upload-desktop-files
Hope this may help you.Bye!
- harsh_bi_dev3 years agoFrequent Visitor
Hello mzzwtr,
I'm getting the SharePoint List Item version history using the method mentioned in your initial reply as below:
It is creating another datasource as Web and when I'm trying to connect to it, it is showing me invalid credentials in Power BI Service.
Please know that I'm adding new column by invoking custom function as below:
And if I go to datasource settings it will show me 3 datasources as below:
Please know that I'm using Gateway to connect to these datasources and it is showing the error of invalid credentials in Power BI Service but working fine in Power BI Desktop.
Hope this information will help you in understanding the issue I'm facing.Let me know if you need anything else as well.
Thank you for the quick turn around.
- GabrielMacedo3 years agoNew Member
It worked fine here, thank you very much.