Showing results for 
Search instead for 
Did you mean: 
New Member

How to Get datasets from all the workspaces with 2 requirements using PowerShell script

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. 


$Workspace = Get-PowerBIWorkspace –All 
$DataSets = ForEach ($workspace in $Workspace)  { 

    Write-Host $workspace.Name ForEach ($dataset in (Get-PowerBIDataset -WorkspaceId 


                         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


Can someone please guide me.

Thanks in advance.


Community Support
Community Support

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.


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.

Helpful resources


2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors