Transcript for:
Simplifying DAX with Power BI Visuals

ever felt overwhelmed by the complexity of Dax formulas in powerbi or maybe you're just getting started and the thought of mastering Dax feels like a huge challenge what if I told you there's a simpler way to handle those calculations say hello to Pal's brand new visual calculations visual calculations simplify writing Dex measures enabling you to directly reference fields in your visuals and that means less hassle and more time to focus on what really matters let me show you how you can use visual calculator to create powerful reports in no time by the way you can follow along with the example file from the link in the video description prior to visual calculations we had to write running total measures using multiple Dax functions in what would be an overwhelming formula for a beginner but now I can simply select the visual that I want to add the running total to then on the Home tab we've got new calculation this opens the visual calculation pane below the visual clicking on FX here there are a load of templates we can use to get started with visual calculations including one for running sum we can see it takes one argument the field and if we delete it I now have a list of the fields in my visual that I can work with there's only one value field that is for sum of sales and that's the one I want so tab to insert it and then press enter and just like that I've got a running total of sales by month in my visual notice in the build pane we've got these I icons beside each of the series and if I only want to show the running sum I can hide the sum of sales from my visual just note that you can't delete the sum of sales though because this has been used by the visual calculation and that's why we now have the ability to hide and unhide items in our visuals I'm going to leave them both visible and I'll click back to report and just like regular measures the visual calculations also respond to the drill up and drill down functionality Plus we can use slices and filter our data let's look at another example another common calculation that's notoriously complicated is a moving average you can see a typical moving average formula here it's not for the fainthearted but it's super easy with a visual calculation let's take a look we'll go into new calculation and then clicking on the function dropdown we can choose the moving average template you can see it's got two arguments the field well The Field's going to be my sum of sales and then the window size is the number of periods I want to average I'm going to average three and let's replace the name here with 3 month moving average and press enter and now I have the moving average in my visual let's go back to the report now if you ever need to edit one of these visual calculations you can click on it and edit calculation it takes you back to the visual C pane you can make your changes and then go back to the report when you're done now there are a few limitations which I'll cover in a moment but first as you can see working with Dax formulas in powerbi can be daunting if you're finding yourself needing a deeper understanding or simply want to master powerbi I highly recommend checking out my pobi power pivot and Dax course bundle it's designed to get you up and running with pobi fast the course builds your skills step by step with practical examples and real world projects and includes support from me personally by the end of the course you'll have the confidence to tackle any powerbi challenge so if you're serious about mastering powerbi and you want to take your data analysis to the next level be sure to check out the link in the description and pin comment so far we've used these pre-built templates to add visual calculations and these templates use a series of new functions that have been built to support visual calculations you can see a list of them here when you add a visual calculation to your model it's not added to the field list like a regular measure which is why you don't see it in the list here and this also means you can't apply number formatting as you normally would however I'll show you a work around here I have a matrix table with sales by manager and segment and I'd like to see sales as a percentage of the grand total so I'm going to add a new calculation now you're not limited to the templates available here you can use regular Dax function let's give this measure a name we'll call it percent of grand total and it's going to divide the sum of sales and the denominator I'll use one of the new visual calculation functions for collapse all what am I collapsing well my sum of sales and then this function wants to know how the calculation should Traverse The Matrix I want to calculate horizontally across the columns from left to right continuing row by Row from top to bottom so I want columns rows close parentheses on claps all close divide press enter and now I have the percentage each value is of the grand total but notice it doesn't have the percentage symbol and remember because these measures aren't in my list of fields I can't format them instead I can edit the calculation so let's go and do that edit calculation and here I'm going to wrap it in the format function and then the format goes in double 0. have two decimal places and the percentage sign and you write these formulas much like you'd write an Excel custom number format so I'm going to close parentheses on format press enter and now we have the formatting let's hide the sum of sales and now I just have the percentages in my table let's go back to the report and there it is job done however another limitation of the visual calculations is you currently can't apply conditional formatting to them if I right click on it you can see the options are quite limited if you want to show values as a percentage of the total let me just unhide this Matrix table a better option currently is to use show values as so right click on the values field show values as percent of grand total now I have the same percentages and if I right click here you can see I also have conditional formatting for example we could give them a background color we'll use a gradient scale and I'll click okay and now I have some conditional formatting which I can't currently apply to my visual Cals visual calculations are currently a preview feature so I'm sure with time these limitations will be resolved and more functions will be available to try out the visual calculations make sure you're running the latest version of powerbi desktop go to the file tab down at the bottom options and settings and then options and then under preview features at the bottom you want to make sure visual calculations is enabled and then click okay and then you'll need to restart powerbi for them to be available as Microsoft continue to improve visual calculations data analysis becomes more accessible and Powerful for everyone if you're an Excel user and you're eager to elevate your analysis skills get up and running with powerbi with my next video where I guide you through step by step I'll see you there