Power View Date Filter Troubles

Now that I’m doing some more development of dashboards in the Power View interface, I thought it might be helpful to post about some of the date “gotchas” I’ve run in to with the development interface.  Power View is very nice about handling Date filters if you are able to specify a date you’d like to use as a start point, end point, or 2 dates to post data about between, however, if you’re looking to determine if a date range is say, “This Week”, “This Month”, “This Quarter”, etc… you’ll have quite a bit more trouble.  The workaround I’ve found to solve this issue is to create a new column that results in a boolean (true/false) answer.  Then within your Power View filtering, you are able to choose “IsPastWeek” = True, etc.  For Example, in your formula bar (or whatever tool you’re using, excel, powerbi, or SSAS tabular):

The above formula, simply put, says If the date is later than today minus 7 days, then return true, else, return false.  Below is a view of the filters in my Power View Dashboard:

By setting this filter, the ability to look at specific dates or time periods makes it easier to report graphically.  Also, the ability to filter on separate objects within the same canvas allows us to easily compare similar time periods side by side.

Some other options for comparing date ranges are:

IsCurrentMonth =if(MONTH(Table[Date])=MONTH(NOW()),TRUE,FALSE)

IsCurrentYear =if(YEAR(Table[Date])=YEAR(NOW()),TRUE,FALSE)

And many more can be found here: Time Intelligence in Power Pivot in Excel

SSMS Database Diagram Crash

I was attempting to create a database diagram with the SSMS 2012 diagramming tool today and ran into the following issue:

“Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Microsoft.VisualStudio.OLE.Interop)”

with the details:


Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Microsoft.VisualStudio.OLE.Interop)


Program Location:

at Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)

at Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)

at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)

at Microsoft.Internal.VisualStudio.Shell.Interop.IVsTrackSelectionExPrivate.Register()

at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConnectSelectionContext()

at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.Activate()

at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.viewManager_ActiveViewChanged(Object sender, ActiveViewChangedEventArgs e)

at System.EventHandler`1.Invoke(Object sender, TEventArgs e)

at Microsoft.VisualStudio.PlatformUI.ExtensionMethods.RaiseEvent[TEventArgs](EventHandler`1 eventHandler, Object source, TEventArgs args)

at Microsoft.VisualStudio.PlatformUI.Shell.ViewManager.SetActiveView(View view, ActivationType type)

at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ShowInternal(ShowFlags showFlags)

at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.<Show>b__26()

at Microsoft.VisualStudio.ErrorHandler.CallWithCOMConvention(Func`1 method)

at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.Show()

at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.MarshalingWindowFrame.<Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame.Show>b__7a()

at Microsoft.VisualStudio.Shell.ThreadHelper.Invoke[TResult](Func`1 method)

at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.MarshalingWindowFrame.Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame.Show()

at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)

at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)

at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)

at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.CreateDesignerWindow(IManagedConnection mc, DocumentOptions options)

at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.InvokeDesigner(IManagedConnection connection)

at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.Invoke()

at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItemBase.MenuInvokedHandler(Object sender, EventArgs args)

So, after some digging, I found a post that suggested I upgrade my tools to SSMS 2014, which yielded the same results, and did not work.

The next post suggestion I found recommended replacing the DLLs in the following location:

C:\Program Files (x86)\Common Files\microsoft shared\Visual Database Tools\


C:\Program Files (x86)\Common Files\microsoft shared\MSDesigners8\

Which also did not work.

If anyone knows of a better work around, I’d like some input!

Power View Drill Drown/Up Bug or, by Design?

While rehearsing my demo for my upcoming session at SQL Saturday Boston this weekend, #sqlsat500 where I will be lecturing and demonstrating Scratching the Surface of Power View, I noticed a quirky issue where I wasn’t able to drill through my column data, but was fine with row data.  Further, after some playing, I was able to drill down if I changed the order of my column values, or tried using other fields.  Everyone hates NULL data, and I think this is just another reason why.  As it turns out, there are some NULLs that happen to show up as the first column when you drill down, so the ability drill “up” is lost, and the only way to get back to your top-level data is to close and re-open the report.

The Scenario:

Using the AdventureWorksDW2014 Data, and building a basic example of creating a matrix, then adding the Drill Down properties, my selections look like this:

As you can see.  A fairly simple example, just trying to capture the essence of Drilling Down and back out again.  When I click to drill down in to the “Black” column, I get the following:

Note, the first column heading has no title, and there isn’t an available “Drill Up” arrow either.  At this point, I’m stuck.  I can’t go back up to my original report, and now need to close and re-open to start over.  If I change the order of the columns so that “Style” is listed first, above “Color”, the Drill Down and Drill Up work fine.  In order to workaround the issue, I replaced all the NULLs in the table with “NA” and Viola! Works perfectly.  I’m not sure if this is by design from Microsoft in order to force the data to have values, but since it’s their dataset to begin with, I’m assuming it’s a bug.

Hope this helps anyone else running into this issue!

Wonky Column Headers in SSRS

Have you run in to issues where your SSRS column headers just won’t scroll with the data?  How about losing the column headers when you go to your next page?  Well, there seems to be some ambiguity about this topic, and anyone who has searched for an answer to their problem has probably run into a bunch of rudimentary answers on how to fix said issues.  I’m living proof that said “fixes” don’t seem to always work consistently, and I have gone ahead and created my own set of steps to address the issue at hand.  I can’t promise it will fix your issues, but in every instance I had the problem, it worked.

For starters, I would read the following page from MSDN to get an understanding of how row and column headings work:


As you can see, this should be pretty simple, but in reality, I can’t get it to work consistently, and it seems many others have tried and failed.

For starters… these settings in the Tablix Properties just seem to cause more issues than help:

If you modify the “Row Headers” and “Column Headers” properties in here (select them), then you will get the following error when you attempt to run your report later… so don’t use them with this method:

This error will ruin your day when you’re using the advanced properties… trust me… I know!

As referenced in the MSDN page, the way to gain better control over the column headers is to use the advanced properties for Row and Column Groups:

After changing to “Advanced Mode”, you’ll see essentially 2 different types of top row.  Either way, the top row with contain the word “static” the major differentiation will whether or not the word is in parenthesis.

What makes the parenthesis critical is that if they’re missing, it means the header row has been deleted.  If the header row has been deleted, my advice is to re-create the report.  You will spend much less time in recreating it than you will chasing your tail trying to fix it!

On the flip side, if that top row has no parenthesis, you should be able to tackle this issue.

Select your top row and go to your properties window:

The key fields you want to look at here are “FixedData”, “KeepTogether”, “KeepWithGroup”, and “RepeatOnNewPage”.  By default, I typically set FixedData = True; KeepTogether = True; KeepWithGroup = After; and RepeatOnNewPage = True.

From there, if it’s not quite right, you can play with those 4 settings to resolve your issue.  Also, I would pay close attention to the bottom section of the MSDN article with regard to “Renderer Support” as there are only a few particular types of renderings for which the repeating rows and headers will work.

I hope this helps!

SSRS Calculating and Converting Time with Expression

Recently I came across a challenging issue with calculating a time span within a group inside an SSRS Report.  I am working on an issue where I need to be able to calculate labor pace operations per hour, and the time a person works on a particular labor task.  My report data looks like the following:

Employee No



240 07:34:21 13.805
07:56:09 13.505
08:24:03 14.890
09:05:17 9.975
09:46:51 13.990
09:48:47 11.560
10:14:31 11.510
10:44:13 13.325
11:07:37 10.245
12:09:19 14.765
12:20:58 13.170
12:42:54 15.735
13:00:49 15.305
13:18:46 16.865
13:28:50 15.365

As you can see, this person submitted their first weight at 7:34 AM with a weight of 13.805 lbs.  In SSRS, it’s fairly straightforward to have a total for the weight, however, a total for the shift proved to be a little more challenging.  I was hoping I could simply use the SUM() function in hopes that SSRS would know how to handle the time format and just give me a total time.  No such luck.  Through a series of trials and errors with the TimeSpan function, I realized that I could use the Min() and Max() functions with a simple math equation.  Ultimately, my formula wound up being the following:


when applying the function, it yielded the a total of:


My next challenge was formatting the total so that it could be used in an equation with the total weight in order to determine my average lbs per hour.  After several hours of trial and error with various TimeSpan and DateDiff/DatePart functions, I found simple was best and ended with this formula to get my results:


this got me  an average of 34.58 lbs/hr and was able to use the formula throughout the report.

Pragmatic Works SSRS Master Class Review

A little while back, the boys from Pragmatic Works (www.pragmaticworks.com) came up to Boston for their “Master” level training series on SSRS. I attended the class, and wanted to share my experience so other interested people can get a preview of what to expect from taking a PW class.


So, up front, I want to be honest about the fact that I am somewhat biased about the training services provided by PW due to my own past experiences in taking their classes. They have a plethora of offerings in relation to the SQL Server Stack and Data topics. I have attended several of their virtual and on-site classes in the past, and am always pleased with the course material, humorous injections, and interesting nuggets they always provide.


Ok, now that the free paid advertisement is over, let’s get to the meat and potatoes of the class.  Taught by Devin Knight (@knight_devin) and Mike Davis (@MikeDavisSQL), the focus of the class was to look at some of the deeper components of how to really expand the capabilities of SSRS beyond the “canned” options and features.  One thing I really like about the presentation style of the courses, beyond the humor, is the fact that they will talk about best practices, give demonstrations and examples of them, then follow-up with tips and tricks to get around some of the nuances of the technology being taught.  This particular course focused on several areas of particular interest to me, and some others that don’t apply to my situation, so they were just good for informational purposes.  The areas within SSRS covered were:

    • Good Report Design
    • Custom Code
    • Reporting from Cubes
    • Utilizing Reports
    • Subscriptions
    • IDEs
    • Configuration and Security

As well as a section on Power View.


Overall, I thought the delivery of the class and the ability of the presenters to break up the material in order to keep it interesting was very good.  Devin and Mike clearly know their stuff, and very obviously love doing it as well as sharing their insight and the various “Microsoftisms” that can occur.  Below is a bit of detail on what worked and didn’t work as well for me about the class specifically.

Good stuff:

  • The examples used about displaying the numbers in such a way that they become more readable by highlighting numbers falling in certain ranges, or more specifically, in-report KPIs, were very helpful.
  • Getting into some of the deeper security and configuration topics offered some different techniques on establishing better security alternatives.
  • The modules on linking and mapping within reports were good to have in this course, as those areas have provided some headaches to myself and my peers in the past.

Neutral stuff:

  • Personally, I don’t do a whole lot with SSAS and Cubes, as most of my work surrounds SSIS and SSRS, but there were some interesting nuggets revealed and “ah ha” moments, as this appears to be somewhat of a tricky subject.

Not as useful stuff:

  • Given the class is at the “Master” level, I’m not sure an entire module and lab needed to be dedicated to Good Report Design.  My assumption is that the majority of the people in the class were there because they have a fair amount of experience in delivering reports, and they were looking for ways to better extend them.  Maybe instead of a module, using poor report design as a “pop quiz” throughout presenting in order to break up the monotony and add some humor.
  • I found the preparation materials for the class to be lacking a bit.  Many of the students in the class (I believe there were around 75 of us) did not have their environment setup correctly on the first day so Mike and Devin spent much of the day running from person to person to make sure the configuration was correct.  I especially remember this being the case for the SSAS and Cube sections.


I’ve been a big fan of Pragmatic Works products and training for a while now and recommend them to anyone that is looking to brush up on their SQL skills, or might have a need for their suite of tools.  I found this class to be helpful and was able to use some of the topics covered almost immediately after taking the class.

Take 1: My first presentation at Sql saturday

I just recently presented at my first SQL Saturday event, SQL Saturday#334 – The Boston BI Session, and wanted to share my experience for future first-timers in the hopes it might help them with their presentations.  Special thanks to Mike Hillwig (@mikehillwig or http://mikehillwig.com/) for giving me a shot for this great event.  I did a fair amount of preparation leading up to the event in order to not be a total flop, and was able to speak at a local user group a couple of months before, which helped immensely. I’m a member of the SeacoastSQL User Group (http://seacoastsql.org/) out of Portsmouth, NH, and got some great guidance and feedback from Jack Corbett (@unclebiguns) after my first demo.  The group is co-run by Mike Walsh (@mike_walsh), and is regularly attended by 10-15 members at our monthly meetings.  I’ll take readers through the process I took to try and improve my presentation skills. Also, I will share the finished product and the elements of the presentation I believe I can improve on, and hope to, for any upcoming SQL Saturday experiences.


Pick a technology:

In order to prepare for my session, I took some time to think about what SQL technology I had the most experience with, and wanted to give an overview about.  I have seen some phenomenally brilliant people in a specific technology completely flop when trying to explain that technology, or freeze up when getting in front of a crowd, so I really wanted to make sure it was something I was very comfortable with.  When choosing my topic, SSRS, I decided it would be good to give an overview of the technology, as well as some “best practice” items for attendees to ponder as they walked away.  Also, I wanted to choose something I was very familiar with in case something went wrong with my demo, and I needed to adjust on the fly in order to keep things from becoming awkward.

Brush up on those speaking skills:

I’ve always been relatively comfortable being in front of a crowd and have loved the opportunity for good discussion.  There seems to be a general mix of people who like speaking and those who don’t.  Being in front of a crowd of your peers should be something to get excited about, and in order to build the community and our knowledge, everyone should try it at least once.  For those who aren’t aware, talking about tech can get a bit boring and tedious at times, so a nice overview of something where it can be kept light, and throwing some “softball” questions out to the audience to keep them engaged were items I focused on when building my presentation.  For those who aren’t comfortable, start with a small group to get feedback, or even just a recorded session to be able to playback your voice and notice what you’re doing that might annoy people.

For my presentation, I was showing a slideshow and a demo all in the same hour-long session.

I’ve actually seen 3 different types of speakers:

  • • All presenting with slides and examples
  • • Some presenting and some demo
  • • All demo

It’s really up to you what you want to do, and what you think will deliver an effective session to the audience.  My topic required some demonstration, and at the same time, gave me the opportunity to instill some methods and best practices for success.

Create a Script:

Some of the best advice I read about and received while preparing for the session was to create a script with some easy to reference queries for necessary coding elements of the presentation.  Also, the other piece of advice I picked up was to always avoid typing in a demo.  Copy and paste any code possible in order to avoid errors and delays.

Build your presentation:

I started with an overview of my background as well as the topics I wanted to cover.  Some people are better at reading from cue cards, but I’m more of an “off the cuff” speaker, so I just jotted down some notes I wanted to highlight in a basic order to go along with a PowerPoint presentation. Successful PowerPoint design rules are posted all around the web about how much content, bullet points, static text, and ways to keep people interested, so do some reading on how to make the presentation flow cleanly.

Practice the presentation:

The old saying is: Practice makes perfect, and not much can be further from the truth. I did a dry run about 6 times to get a sense of how long the whole presentation would take as well as putting the order of topics to memory.  From there, I recorded a session using the Camtasia Studio and sent it to a few friends to critique.  I knew I would be presenting for about an hour, including questions, so I made sure to leave time for interruptions, system stalls, and anything that might slow me down a bit.  My dry runs were taking about 45 minutes and when it came to the actual demonstration, it took 1 hour and 1 minute, so I was pleased with the timing.


When I reviewed the comments from the session evaluations, there was a mix of people who came to get introduced to the technology, and people who were refreshing their skills from some time ago.  Most people felt that they walked away having learned something, which means I succeeded in my mission. On a 1-5 scoring system, 5 being the best, I received many 4’s and 5’s, and a few 3’s, so it would seem people were pretty pleased with the topic and presentation.

Next time:

Among the items I learned in this presentation was that you can expect a wide range of questions from people, both on topic and off. I found myself spending time on questions that weren’t necessarily relevant to the conversation, so be aware of the audience and do your best to filter without being rude to the questioner if the question is off topic.

SQL Saturday events are for learning and networking, so if you find someone is showing interest in your topic, and/or somewhat jumping in and answering questions directed at you, I would suggest engaging that person after your session is over. This is a good opportunity for you to possibly learn more about the topic, or have a resource to rely on when you might be running into issues with a project.

Unable to deploy package to ssis 2014 Catalog

Recently ran into trouble because our Active Directory environment was upgraded to 2012, and I could no longer deploy packages to our SQL Server 2014 SSIS Catalog due to the following error:

A .NET Framework error occurred during execution of user-defined routine or aggregate


System.ComponentModel.Win32Exception: A required privilege is not held by the client


at Microsoft. SqlServer. IntegrationServices.Server.ISServerProcess.StartProcess(Soolean


at Microsoft.SqlServer.IntegrationServices.Server.ServerApi.DeployProjectlnternal(SqlInt64 deployld,

SqIInt64 versionld, SqlInt64 projectld, SqlString projectName)

. (Microsoft SQL Server, Error: 6522)

I found a nice blog post from Archana, a Microsoft SQL Developer, that helped resolve the issue, but was a bit wordy with the solution.


Long and short of the article was to follow the steps outlined below for the user account that needs access, and then run gpupdate on the server in question:

Odd authentication behavior

Just recently I came across some odd behavior when trying to connect to my SQL 2012 server via and SSIS package and ultimately SSMS from an external connection.  I’ll cut to the chase and tell you that the error I was receiving was the following:

The target principal name is incorrect. Cannot generate SSPI context. (.Net SqlClient Data Provider)

As it turned out, something went awry with the trust connection between the SQL server and the Active Directory Domain Controller that was not allowing my user account to authenticate.  Simply going into SQL Server Configuration Manager and re-entering the user password for the various services resolved the issue, however, not so simply, it took me about 7 hours of tweaking to figure out that was the problem…

The odd thing about this is that I was working in my environment on a Tuesday with no issues, connecting externally, etc.  Wednesday I was traveling for work, and upon my return on Thursday, any external connections I tried resulted in the error above.  The really strange thing about the error is that I could connect locally just fine, and I would only get it for external connections.

I went through the normal steps to check for external connectivity i.e.:

  1. Reboot (Fortunately, it’s just a server used for reporting, and not our SAP installation)
  2. Make sure SQL Browser and other services were running
  3. image
  4. Check the windows firewall (did an external port scan to make sure 1433 was open)
  5. Check the SQL Server Network Configuration protocols were enabled
  6. image
  7. Make sure external connections were enabled in Database Properties
  8. image

Even after all these steps and more, I simply could not find an answer, so I turned it over to my Sys Admin for another set of eyes, and almost immediately he found it by changing the “Log on as” account to local system.  This wouldn’t solve my problem completely, because I would need access to network shares within the domain, however, it got me pointed in the right direction, and viola! I was back in.

As it turns out, we have been recently doing some work on our domain as they put Win Server 2003 to End of Life, and upgraded to Windows Server 2012 Active Directory.  This helped me to remember that even when you think everything is working and configured the way it should be, there are always situations where something that’s happening externally to your own “silo” can still affect what you’re doing.  Always check with the Sys Admins and bounce the question of team mates when you run into issues.

SSRS 2008R2 Parameterized Reports stop working

SSRS 2008R2 Parameterized Reports suddenly stop working

After a recent round of Windows Updates, one of my SQL Server Reporting Server 2008 R2 users complained that reports were not working properly.  After some digging, I realized that in-fact, some of the reports were actually working, it just turned out to be the ones that require parameters.  The error looks like this:


The first thing I noticed was the “Error” message at the bottom that didn’t yield much information:


Although it got me pointed in the direction of something wrong with the Web Server.  In SSRS 2008, Microsoft changed the infrastructure and design of how the reporting services interacts with the different components and also eliminated the need for IIS.  Stacia Misner does a good job explaining this here:


By getting this information it made me realize that there was clearly no reason to continue messing with IIS to try to resolve the issue, so I began searching for the error I found in the log of SQL Server Reporting Services at:

C:\Program Files\Microsoft SQL Server\MSRS10_50.SQLREPORTING\Reporting Services\LogFiles

The error that I found was:

System.Web.HttpException: The URL-encoded form data is not valid. —> System.InvalidOperationException: Operation is not valid due to the current state of the object.

And finally after an extensive search, I found this posting in MSDN:


Looks like there was a Windows Update (KB2656351) that I had installed on Jan 12, 2012 and Possibly another (KB2656356) which did not affect me.  I uninstalled the first KB and rebooted, however, it did not resolve my issue.  By reading through the posting, I attempted the other suggested fix by modifying the web.config file found here:

C:\Program Files\Microsoft SQL Server\MSRS10_50.SQLREPORTING\Reporting Services\ReportManager

Inside the <appSettings> tags:

<add key=”aspnet:MaxHttpCollectionKeys” value=”10000″ />

10000 is just a suggestion, you can set it to the value of your liking depending on the sizes of your parameters.

And my problem was resolved!