Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Akshay1994
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. 

 

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.

 

1 REPLY 1
v-yalanwu-msft
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.

https://stackoverflow.com/questions/53720478/is-it-possible-to-get-reports-by-filtering-using-power-...

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors