Hello, I have a script where I see all the datasets from all the workspaces in my organization but I have 2 conditions to add in it that is where I get stuck.
If I need to get the list of datasets from all the workspaces with the condition of dataset being updated/modified (not refereshed but updated or modified) in last 7 days and using the dataset source to check if it has its own dataset (not pointing/referring to other dataset). How can I achieve this?
So far this is the script I got which only gives me list of all datasets from all the workspaces.
Connect-PowerBIServiceAccount
$Workspace = Get-PowerBIWorkspace –All
$DataSets = ForEach ($workspace in $Workspace) {
Write-Host $workspace.Name ForEach ($dataset in (Get-PowerBIDataset -WorkspaceId
$workspace.Id)){
[pscustomobject]@{
WorkspaceName = $Workspace.Name
WorkspaceID = $workspace.Id
DatasetName = $dataset.Name
DatasetID = $dataset.Id
}
}
}
$Dir = "C:\myShare\pbi\MyWorkspace.csv" $DataSets | Export-Csv $Dir -NoTypeInformation -Encoding UTF8
Disconnect-PowerBIServiceAccount
Can someone please guide me.
Thanks in advance.
Hi, @Akshay1994 ;
Refer to the following posts to set up filters. Or try to get the refresh time of the data set and filter within 7 days.
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/get-refresh-history
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.
Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!
Join the biggest FREE Business Applications Event in LATAM this February.