Monday, November 7, 2016

Change Power BI Report from DirectQuery to Import

I have a report that I wanted to quickly publish to share with our CEO as a Power BI dashboard. The problem is that we do not have a gateway built yet to give him access to the data. I could not find a easy way to change the report from DirectQuery to Import before publishing the report so he could view and interact with the data. I found a way around this limitation this way.

1. Go to the Edit Queries section.
2. Select any of your columns, Right Click, and select Replace Values.
3. Enter any values in the Value To Find and Replace With boxes and click OK.
4. You will then see a Yellow Bar across top reading "This step results in a query that is no supported in DirectQuery mode." Click on the Connection Settings and Change to Import.
5. After making the change then deleted the Replaced Value in the Applied Steps section on the right of screen.

You now have converted you report to an Import from Direct Query so it can be Published and shared without setting up the Gateway.


Tuesday, April 26, 2016

Powershell - Who rebooted my server?

If you work in a shared environment with multiple users having access and rights to your servers it is always good to be able to show who rebooted the server last. Here is a quick script to show you just that.

I like to run the script from the server because I don't always have rights with my account, but always have a service account that can access the server.

Ola Job Schedule Script

Many of you probably already use the Ola Hallengren (https://ola.hallengren.com/) backup and maintenance scripts. If you don't definitely look into them. The one complaint I had was that I had to schedule the jobs to be on our standard schedule after I installed the scripts. It took a few installs before I finally took the time and put together a quick script to create the schedule and attach it to the jobs. Now all I have to do is run the Ola script to add the jobs and underlying stored procedures and run my script to schedule them to the appropriate time. I took the 15 minute process of setup down to 2 minutes. All that time spent adding efficiency lets me get to lunch on time.

USE msdb
GO
 
 

EXEC sp_add_schedule
@schedule_name = N'Weekly-Ola' ,
@freq_type = 8,
@freq_interval = 64,
@active_start_time = 041500,
@freq_recurrence_factor = 1 ;


GO
 
 

EXEC sp_attach_schedule
@job_name = N'CommandLog Cleanup',
@schedule_name = N'Weekly-Ola' ;



GO
 
 

EXEC sp_attach_schedule
@job_name = N'Output File Cleanup',
@schedule_name = N'Weekly-Ola' ;



GO
 
 

EXEC sp_attach_schedule
@job_name = N'sp_delete_backuphistory',
@schedule_name = N'Weekly-Ola' ;



GO
 
 

EXEC sp_attach_schedule
@job_name = N'sp_purge_jobhistory',
@schedule_name = N'Weekly-Ola' ;



GO
 
 

EXEC sp_add_schedule
@schedule_name = N'Weekly-Ola_Integrity' ,
@freq_type = 8,
@freq_interval = 64,
@active_start_time = 191500,
@freq_recurrence_factor = 1 ;



GO
 
 

EXEC sp_attach_schedule

@job_name = N'DatabaseIntegrityCheck - SYSTEM_DATABASES',

@schedule_name = N'Weekly-Ola_Integrity' ;



GO
 
 

EXEC sp_attach_schedule
@job_name = N'DatabaseIntegrityCheck - USER_DATABASES',
@schedule_name = N'Weekly-Ola_Integrity' ;



GO
 
 

EXEC sp_add_schedule
@schedule_name = N'Weekly-Ola_Optimize' ,
@freq_type = 8,
@freq_interval = 1,
@active_start_time = 041500,
@freq_recurrence_factor = 1 ;



GO
 
 

EXEC sp_attach_schedule
@job_name = N'IndexOptimize - ALL_DATABASES',
@schedule_name = N'Weekly-Ola_Optimize' ;



GO
 
 

EXEC sp_add_schedule
@schedule_name = N'Weekly-Ola_Backup' ,
@freq_type = 8,
@freq_interval = 1,
@active_start_time = 191500,
@freq_recurrence_factor = 1 ;



GO
 
 

EXEC sp_attach_schedule
@job_name = N'DatabaseBackup - SYSTEM_DATABASES - FULL',
@schedule_name = N'Weekly-Ola_Backup' ;



GO
 
 

EXEC sp_attach_schedule
@job_name = N'DatabaseBackup - USER_DATABASES - FULL',
@schedule_name = N'Weekly-Ola_Backup' ;



GO
 
 

EXEC sp_add_schedule
@schedule_name = N'Hourly-Ola_Backup',
@freq_type = 4,
@freq_interval = 1,
@freq_subday_type = 8,
@freq_subday_interval=1,
@active_start_time=0,
@active_end_time=235959,
@freq_recurrence_factor = 1;


GO
 
 

EXEC sp_attach_schedule
@job_name = N'DatabaseBackup - ALL_DATABASES - LOG',
@schedule_name = N'Hourly-Ola_Backup' ;


GO
 
 




 
EXEC sp_add_schedule
@schedule_name = N'Nightly-Ola_Backup',
@freq_type = 8,
@freq_interval = 126,
@freq_subday_type=1,
@freq_subday_interval=0,
@freq_relative_interval=0,
@active_start_time = 191500,
@freq_recurrence_factor = 1 ;


GO
 
 

EXEC sp_attach_schedule
@job_name = N'DatabaseBackup - USER_DATABASES - DIFF',
@schedule_name = N'Nightly-Ola_Backup' ;


GO