A Power BI Technique Mined from the Power Pivot Archives
Below, you will find one of our all-time favorite Power BI techniques. In the ten (yes ten) years we’ve been operating this site, we’ve written over 1,000 articles on Power BI. Hard to imagine - even for us - but true.
Years ago, we first wrote up this technique in the context of Power Pivot – Power BI’s cousin and predecessor, which we like to call “Power BI in Excel.”
Since the two products share the same brains (DAX and M), this technique is more relevant today than ever. Everything below is 100% legit for Power BI – the same data model “shape,” the same DAX, etc. – but now you can use it to power up your Power BI visuals, and not just PivotTables. Enjoy!
Hey folks, got another special guest post for you. Today we are honored by the presence of the SillyBoy himself, Scott Senkeresty. Scott is a very close friend of mine that I met in my first week at Microsoft. These days Scott is still at Microsoft, working on antivirus features.
…and like all of my techie friends, he hears a lot about PowerPivot from me, and has been playing with it in his work. Here is one of his recent experiments:
This is a query you can run against any sql database:
It uses a dmv in sql that shows intersesting stats about your index. I used it against our production database, and added a calculated column for “Total Reads” = Seeks+Scans+Lookups.
Then I create a Chart n’ Table… just cuz. I created Slicers for TotalReads, Updates, and Index Name (for kicks). I added Index Name as a Row Column and Reads as values.
Now it’s time to par’tay.
I am interested in finding under-utilized indexes (lots of updates, few reads). So, I just use the read slicer and select the first 5 or so. The update slicer automagically updates… and I scroll down the remaining “big numbers”. Select 5 or so of those… and <poof!> my data!
Notice that my Index Name slicer has my nasty’s highlighted. Not required since my table & chart show that data, but it’s cool to see that auto-filtering works so well, I almost don’t need the charts.
And hey look, an index with 26 million updates, and not a single read… Thanks Power Pivot!
And here is the query again as text in case you want to copy/paste it into PowerPivot’s query tool:
SELECT object_name(s.object_id) as [Table Name], i.Name as [Index Name], user_updates as Updates, user_seeks as Seeks, user_scans as Scans, user_lookups as Lookups FROM sys.dm_db_index_usage_stats AS s INNER JOIN sys.indexes AS i ON s.object_id = i.object_id AND i.index_id = s.index_id WHERE objectproperty(s.object_id,’IsMsShipped’) = 0 AND s.database_id = db_id()