⏱️ CHAPTERS 00:00 Introduction and Overview of 11 Power BI Tips 00:39 Tip 11: Turn Off Auto Date Time and Manage Date Tables 03:08 Tip 10: Replace Nested IFs with SWITCH TRUE in DAX 04:43 Tip 9: Avoid Unnecessary DAX by Calculating Upstream 06:06 Tip 8: Use Power Query Parameters for Environment Switching 07:35 Tip 7: Use Test Mode Parameters to Limit Rows During Development 09:15 Tip 6: Create a Dedicated Measure Table for Organization 10:20 Tip 5: Bulk Edit Measure Properties in Model View 11:04 Tip 4: Reuse Semantic Model Logic with TMDL Calculation Groups 12:28 Tip 3: Use Control G Shortcut to Quickly Navigate Columns in Power Query 13:08 Tip 2: Use Field Parameters for Dynamic User-Controlled Visuals 14:41 Tip 1: Use Control Shift L to Bulk Rename in DAX Editor 15:30 Conclusion and Final Thoughts
Yooo! 🙌 take your data skills to the next level and join fellow data professionals in our community THE CUBE: https://guyinacube.com
0:00 Introduction to Power BI Tips
1:50 Model Control and DAX Optimization
4:52 Data Transformation and Parameter Management
8:53 Model Organization and Measure Efficiency
10:23 Advanced Visual and Calculation Techniques
12:31 Keyboard Shortcuts and Productivity Hacks
This video provides a ranked guide to Power BI best practices, focusing on enhancing model efficiency, maintainability, and development speed. It encourages a shift from inefficient habits to professional workflows, covering everything from date table optimization and streamlined DAX logic to advanced tools like Tabular Editor and Field Parameters.
What is up everyone? Power BI people love to share tips. Some of them are genuinely useful.
Some of them pretty clever. Some solve problems though that shouldn't exist in the first place.
And a few of them are absolutely bananas. So I pulled together 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11 Power BI tips that people swear by and I ranked them from 11 all the way to number one.
I'm looking at how useful they are, how surprising they are, and whether I actually use them in a
real Power BI project. You know how we like to do? Let's get into this. Coming in at number 11,
turn off auto date time. When you add a date column to a Power BI model, Power BI automatically
creates these hidden date tables behind the scenes. And for a quick report, that's fine.
But once you start building a real semantic model, you want to take control of your date table.
And you can see how I have this full date column in my model. If I check it, you'll see I have all
of these different values, year, quarter, month, day. And if I go to booking date, you can see I
have another one. If I go to guest satisfaction, I have another date. And for every one of those,
if I connect to DAX Studio and it's creating these hidden 2, 3, 4, 5 date tables for me.
So how do you get rid of these? Well, there's a couple of things you can do. So if you go over
to your model, the first thing you can do is create a date table, establish relationships.
So you can use that central date table. That's a topic for another day. And if I right click
right here, I can go to calendar options, say market's date table, turn it on, choose my full
date. Remember we had five before. I'm going to click save. You see how that went away right there.
See how this is a date now. And if I go back to DAX Studio, you can see I'm down to four,
one, two, three, four. How do I get rid of the other ones? Let's go back to Power BI Desktop.
You can do a couple of things. You can go file option settings and options,
and there's two locations. There's in the global and current file, you can do data load
and data load. So on data load, I can turn off auto date time in the global. That means for
every subsequent Power BI Desktop file that I open, it's not going to create those hidden date
tables for you. And if I do it right here, it's going to turn it off just for this local file,
this current file. So I'm going to uncheck it, click okay. And then if I go back here,
they're all gone. Now I'm going to turn it back on. You can see all my date tables are there.
And so if I go here, right now, my relationship to my date table is on keys, integer values. But
if I switch them up, because I actually have the dates. So if I switch this to stay date,
and I switch this to full date, which is my actual date, I click apply. We go back to DAX
Studio, you'll see I'm down to three. And as I continue to iterate through this, it'll get rid
of all those date tables. One warning, if you already use one of these automatic date hierarchies
in a visual, turning this off can break that visual. So don't just flip flop and switch and
hope for the best, right? Check it out, test, validate. And this is good hygiene. It helps to
reduce clutter, it gives you one consistent date table, and it puts you in control of the
intelligence. Let's see what's next. Replacing those deeply nested if statements with switch
and true. I have a table here with property name. And so I have two measures. One, that's an if.
It's pretty straightforward. If it's not in scope, if it's not at the property level, show portfolio
total. But if I'm in the context of property, if total revenue is greater than $35 million,
exceptional. $25 million, strong. Greater than or equal to $15 million, moderate. Otherwise,
display low. I'm going to add this to the table. And you'll see it's actually telling me something.
I have some properties that are strong, moderate, low, exceptional. And you can see that if I'm not
in the scope, it shows portfolio total. And this works. But imagine every time I add another if,
I get deeper and deeper in the if. So I'm going to replace this with a switch. So much easier to
write and so much easier to understand. Here's my switch, here's my true. And so if it's not
in scope, show portfolio total. Otherwise, follow the same rules. And if none of these conditions
meet, show low, right? So I'm going to add this and it does the exact same thing. There's one
important detail here. The order matters. Switch stops at the first condition that evaluates the
truth. So I need to start with the highest threshold and work my way down. So let's say
in my switch statement, I said if total revenue was greater than $15 million, a property with $40
million would satisfy that condition and Power BI will return moderate. This one may not seem
bananas, but once conditional logic starts growing and growing and growing, switch true
makes the intent a whole lot easier to see. No DAX. DAX should not be the first answer to
every problem you encounter. So take a look at my total revenue column. This works, but the
business rule itself is absolutely static. The revenue is room revenue plus experience revenue
plus other revenue minus discount amount. That row level calculation does not need filter context.
So I can create net revenue upstream in SQL, Power Query on the warehouse. So if I go over to
my SQL server, you can see I've created a computed column that does the exact same logic. Room
revenue, experience revenue, other revenue minus discount amount. And then if I go to Power Query,
I can go to booking and I can go find those columns. Room revenue, this and this, and I can
do some maths and say sum these two, then I can subtract that one from it and I get the exact
same result regardless of the approach I take. And I can do a new measure. So instead of writing
that DAX, I can say total, and I know I already have one, equals sum net revenue. That's all I
need to write. Measures, ratios, calculations that depend on filter context, they belong in DAX.
Cleanups, static classification, and repeatable row level business rules often belong upstream.
I think it's roaches maximum, maximums roaching, something like that. That distinction absolutely
matters. Use Power Query parameters to move between development, tests, and production.
Let's go over into Power Query. So we choose transform. And the first thing we're going to do
is create a couple of parameters. We're going to say manage parameters, and we're going to do new,
and we're going to say server name. We're going to add another one called database name. And I
already have them. So the database name is North Star Public. And then the server name, we're going
to go over to Management Studio. Not because I'm lazy, I'm just efficient. And I'm going to copy
this. And then we're going to go back over here, and we're going to paste this in. And one thing
I like to do is really typecast. So I'm going to say this is text, and this is text. And what I'm
going to do is say OK. And then I'm going to go to view, and we have to allow parameters. So you
need to check that box. And then we'll go back here. We're going to go to data source settings,
and we're going to change this source. And so instead of hard-coded values, we're going to use
parameter, server name, parameter, database name. Click OK. Click close. It'll take a little bit.
There we go. If we go into the Advanced Editor, what you'll see is server and database name.
Changes it everywhere. You can go into each one. And if you take a look at the first step in the
code, you'll notice that it's server and database name. Now the query is not tied to one environment.
When I need to move from development to test or production, I change the parameter value instead
of rewriting the entire query. This is not something that every report needs. But once you
are working across multiple environments, hard-coded connection information gets old really fast.
When I'm developing my Power BI Semantic Models, I don't want every row from a very large table.
I may only need enough to build a transformation, validate the model, and make sure everything
works. So what I do is I'm going to create a couple of parameters. I'm going to create one
called testMode. And I'll make it trueFalse. And I'm going to set it to false. And then I create
another one called testRowCount. And then I'm going to make this one a decimal. And what I'm
going to do is set it to 10. And click OK. And then what I'm going to do is I'm going to create
a new blank query. And inside that blank query, all I'm going to do is paste the query that I've
created. And what you'll see, I'm using my server parameters. I'm doing a little m here. I said,
if it's testRows, only show the first however many rows I put in. In my case, 10. So if it's
true, only show 10 rows. Otherwise, return the entire table. So you can see it's returning lots
of data right now. So what I'm going to do, I'm going to switch this from false to true and watch
what's going to happen. It only returned 10 rows. If I go here and switch this, it's only going to
return 20 rows. Now I can work against a smaller data set while I'm developing, then turn testMode
off before the full refresh. There is one important nuance. You need to pay attention
to query folding and where the row reduction actually happens. If Power Query pulls the entire
data set across the network and only then keeps 20 rows or 10 rows, you didn't really save much.
The goal is to push that reduction back to the source whenever the connector and transformation
supports it. This is a small pattern, but on a large data set, it can save a lot of time waiting.
Coming in at number six, the measure table. So in this model, I have measures spread across
two tables. I have them on the guest satisfaction table, and I have them on my booking table.
So let's go back here. Let's go to modeling, and we're going to do a new table. I'm going to call
this measures equal data table. I'm going to say placeholder. I'm going to make it an integer.
And then inside of there, I'm going to do one, one. I messed up right here. Integer comma.
So this creates my table. Now I can go to my model view, and I can start moving my measures.
And so I can go here, and I can say change this to measure. I hide this column. Easy. There we go.
And now I can move all my measures to this table. Nothing was wrong with having all my
measures spread across the table. Now they're all in one location, and if you start getting
too many measures in that table, you can use display folders for revenue, for occupancy,
for different things. Some developers also prefer keeping measures within the related fact table.
And that's a good thing. This does not make the model faster, but a clean model is a whole lot
easier to what? Maintain. Getting to the good stuff. Bulk editing in the model view. Look at
this. I have several measures. Room revenue, total revenue, total revenue previous year.
Now I can choose room revenue, and I can go to formatting and change it one at a time,
but I can also do a multi-select because I know these are all currencies, and I can say currency
and set my decimal place. And now if I select them individually, you can see that the formatting
is applied. Now what I can also do, check this out. I'll go here and say select all measures,
right? All my measures are selected, and I'm going to go to general, and I'm going to move
all of them to my measure table. You can use this for other compatible properties beyond formatting
like display folders, summarizations, and other metadata. This can save a ridiculous number of
clicks. Coming in at number four, it's the ability to use Temdo to stop rebuilding the same semantic
model logic over and over again. Take a look at this. Here's my model, and I have measures like
ADR, total revenue, and ref par. And you can see I've already started building in some time
intelligence, and you'll have to repeat building that logic over and over and over again. But take
a look at this. Let me go over to my Temdo view, and I'm going to paste in some code. And so you can see
I'm creating a calculation group. One thing you got to do before you do this is you need to go
over to the model view, and you need to discourage implicit measures. So we're going to discourage
implicit measures. Now you have this chunk of code. Now watch this when I apply this,
and I need to refresh so my calculation group gets all the information. So now instead of doing this
over and over again, watch. I'll get rid of this. I'll add my calculation group to the column. That's okay.
No fret. And then look, I have all the changes automatically built in. Think about it. I don't
have to write that code over and over again if I get rid of this and say, look, let's just use
this for bookings. It automatically works for bookings or any other measure in my model. You
still need to check the table names, column references, dependencies, and formats before
applying anything. But the next model doesn't have to start from zero. You can keep reusing the Temdo
starter blocks for the model objects you create over and over and over again. Review them, share
them, and apply them where they make sense. All right. Some of you may laugh at number three,
and that's control G in Power Query. Hear me out. So go to transform, and let's say you have this
very large table like booking right here. And you can see there's lots of columns in booking. And I
can go search for whatever column I'm trying to get to. But guess what? How many of you have done
this? Control G. There's the columns. I want to go to stay date. I click OK. It automatically
brings me to that column. Control G. I want to go to guest key. It automatically brings me to that
column. I want to find a column buried somewhere in the middle. I can keep scrolling until I
eventually find it. Or I can just press Control G, and there it goes. Coming in at number two
is field parameters. Field parameters let the person using the report dynamically change which
dimensions or measures appear in a visual. Check this out. I have a clustered bar chart,
and you can see I have total revenue by property name. But I want my users to switch this by region,
property type, and booking channel. I could build four visuals and try to fit them all on the page,
or I can go to modeling. I can choose new field parameter. And then what I can do is I will choose,
let me see, property name, booking channels, choose channel name. Let's get one more in here,
region. Search for region. Where's region at? There we go. And I'm going to choose region.
Click create. It's going to add that as a slicer. It's oh so small. We'll do a quick format of this.
And so what I'm going to do is go here, and instead of using property name, I should have
gave my parameter a better name. I'm going to drop it right there. And now what I can do is
choose property name, choose channel, choose region. But it doesn't stop there. I can also go back to
modeling, and I can choose a new field parameter. I'm going to give this one a better name. And then
what I'm going to do is go to my measure table, because everything is in the right place. Bookings,
occupancy rate, total revenue, any of the measures I want to add, right? Click create. And then
instead of using total revenue, drop that right there. And now watch this. The entire thing is
completely dynamic. Now the user can change both the category and the calculation. I'm going to say
it. This is insane amazing. Drum roll please. Coming in at number one. Control shift L. Inside
TimbleView are the DAX formula editor. So if we go here and do a quick search, you can see I have
a few measures that are prefixed with AVG. And I want to rename them to average. So I just so
happen to have a script on my clipboard of all three of them. Watch this. I'm going to double
click here. I'm going to do control shift L. It highlights them all, and it changes them all. And
then I say apply. And now if I look for average, all the abbreviations for all four measures went
from AVG to average bananas. You do need to pay attention to the exact text you select. If that
text appears inside names you did not intend to change, Power BI is going to select those for you.
So be careful. And there is definitely someone who thinks one of these should not have made the list
at all. But based on practical value, surprise, and how often I would actually use each one,
that's my order. And as always, thanks for watching. We'll see you in the queue.