Tag: Tutorials

  • Tips+ Designer and Theme Generator Tutorial: Gallery Project Copy & Edit

    Tips+ Designer and Theme Generator Tutorial: Gallery Project Copy & Edit

    Introduction

    Welcome to today’s tutorial where we dive into the powerful capabilities of the Power BI Tips+ Theme Generator. In this post, we won’t just download a project from the Gallery; instead, we’ll guide you through the process of copying and editing a project file using the Power BI Tips+ Theme Generator. Today, we’ll focus on the Framed Orange theme to showcase the flexibility and customization options available.

    If you prefer to follow along via video, you can check out the full walkthrough on the PowerBI.tips YouTube video here:

    Step 1: Copy and Edit Project File

    Start by selecting the Framed Orange theme in the Power BI Tips+ Gallery. Click on “Copy and Edit” to open the project file. The Gallery project will open this project in your workspace and show you all the pages and visualizations in the Wireframe area.

    Step 2: Customizing Project

    Upon opening the file, you’ll notice wireframes representing the background and areas where visualizations will go. These project files contain all of the backgrounds, visuals and theme properties. In this case we have a palette and visualization properties set, so they are also imported. In our example, a gray border is applied to all visuals and a suite of colors is found in the palette.

    Step 3: Applying Changes

    Make changes to the project file as needed. In this tutorial, we’ll curve the edges of visualizations in the properties area, and bring in our own custom color palette. Easily add hex codes of your preferred colors to personalize the project.

    Step 4: Preselecting Visualizations

    As you navigate back to the Wireframes section you can see how easy it is to add the visuals to the predefined visual objects. You aren’t locked into these though and you can easily change the size and position. We’ve thought of that too! On Page 3 of this project, for instance, the project file has a large table.

    Instead of using that, you can choose from predefined templates of visual objects to easily apply to the background. This feature makes it easy to align and space visualizations appropriately.

    Pick the one that suites you best, and apply it to your background. Now that we have that, we can choose which visuals we want to add for easily dropping our data into.

    Setting up a background, and perfectly aligned visuals to create beautiful reports has never been easier!

    Step 5: Downloading the Modified pbip File

    Download the modified project file (pbip) file to your computer. Extract the files and open the PBI file in Power BI Desktop. You will see that all of our properties, new theme, and background are all applied to the report.

    Step 6: Adding Data

    Load your data or use a sample dataset to see the visualizations populated. Drag and drop or select visualizations to add your data into the pre-configured fields.

    Step 7: Exploring My Files Section

    Did you realize you missed a few properties or colors, or maybe wanted to add one more page? Not a problem, you can go back and tweak the project file any time you want, because its yours! Discover the My Files section in the Power BI Tips+ Theme Generator, where you can explore and update all settings and properties for your current and future projects.

    Conclusion:

    With the Power BI Tips+ Theme Generator, you can effortlessly customize and enhance your Power BI reports without spending large amounts of time tweaking all the visualization settings for every report you create. Use the Tips+ Theme Generator to create amazing templates to use over and over again!

    Stay tuned for our next tutorial, where we’ll delve into the exciting new AI features within the Power BI Tips+ Gallery. Elevate your reporting game with simplicity and efficiency!

  • Scale a Visual

    Scale a Visual

    For each visual in Power BI Desktop there is a button called Focus Mode. This feature highlights a single visual. While this can be helpful, it does remove the ability to change or adjust the visual based on filters or slicers. I’d like to introduce to you the concept of Scaling a visual.

    In this tutorial we walk through how to take a collection of visuals. Then group all the visuals. Finally, control the group of visuals by hiding or showing them with bookmarks.

    Check out this video tutorial on how to accomplish this within Power BI Desktop.

    Tutorial Video

    Downloads

    Download the icons and sample PBIX file at my GitHub repo.

    Download the layout used in this tutorial here.

    Other Resources

    Here are some other great tutorials around using the grouping feature in Power BI Desktop.

    If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel.  Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.

    Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:

    Check out the new Merch!

    Hasta La Vista Data
    Go Ahead Make My Data
    PBIX Hat


  • Consolidate Report Pages Easily with Visual Grouping

    Consolidate Report Pages Easily with Visual Grouping

    We do a ton of Layouts here at powerbi.tips and with the introduction of the new visual grouping feature I was looking for different ways I could utilize that functionality to make templates for different reporting scenarios. First, if you aren’t familiar with how to build a visual group, be sure to check out a blog Mike wrote on this a little while ago on the subject.

    While I was exploring an idea of how I might leverage this new feature, a challenge I’d seen re-occurring in the Power BI Community forums popped to the forefront of my mind. This new feature gives a perfect solution for answering the question of Report page consolidation.

    Time and again I’ve seen people talk about navigation issues related to the number of pages or tabs they have in their reports. Sometimes, particularly in embedded scenario’s, you can’t reduce the pages and break them up into smaller reports. This could already be accomplished in the past, but man oh man, good luck finding what you were looking for in the selection pane. Let me show you how easy this is to accomplish with the addition of the new visual grouping feature. By walking through these few examples you can extend this to however many pages you need following the same patterns I describe below.

    Setup:

    On your main page, make some room for buttons that you can create to toggle your pages on/off.  You can see I did that in the image below.

    Next we’re going to click on the top object of the selection pane and hold SHIFT + Click the last object, this will highlight all the objects.

    Right click and select Group from the drop down menu.

    This will create a “Group 1”

    Let’s rename this to Page 1. You can do that by Double Clicking on the group name and typing in the new name, Page 1.

    Next, we’ll create a button called “Page 1”

    Select the Home ribbon, then click the icon called Buttons.

    Choose a Blank button from the drop down. In the formatting pane under the visualization area choose the section titled Button Text and toggle it on, then type in Page 1.

    Place the button in on the right side of the screen.

    Great, now since we just created this button, let’s create a second button. This one will be for our “Page 2”. Follow the same steps above or select the Page 1 button and do a CTRL + C (copy command) / CTRL +V (paste command) to create a new button. Rename it to Page 2 and you should end up with this

    Prep Additional Page

    Now, here is where this gets cool. Imagine you have N number of pages, all with roughly 10 objects on each page. We are going to go to each page and condense all the objects down to a single one. Go to your second page, in the same fashion that we created our page 1 group, we select all the objects in the selection pane.

    An alternative method would be to just click on your report canvas and CTRL + A to select all objects, then right click and create group. We now see our new group in the selection pane and we can double click to rename it Page 2.

    Bring It Together

    Now Click on the Page 2 group and hold CTRL +C to copy the group

    Navigate to page 1 and CTRL + V to paste the group.

    This will bring all the objects from your Page 2, to page 1 and it will look like a giant mess similar to this

    But you know what isn’t a mess? The Selection pane! Because we created the group, all we need to do is toggle the Page 2 visual icon to off

    And our page looks normal again. Now let’s hook up the buttons and bookmarks.

    Go to the View ribbon and open the Bookmarks pane.

    Click the Add button at the top of the window. This will create a snapshot of the current state of the report page. Double Click the bookmark that is created and change the name to Page 1.

    Now, toggle the Page 1 visual group off from the Selection Window. Then turn the visibility of Page 2 visual group to on.

    Create a second bookmark. Now, change the name to Page 2. You’ll likely notice that things just aren’t aligned right (at least in my case that is true because I’m using a background.

    But since the visual grouping is its own object, all I need to do is select it and all the visuals resize for me! I don’t have to individually mess around with each one! Super cool.

    The last thing we need to do is connect our buttons with our bookmarks. We Select the Page 1 button. Choose the Action in the formatting and toggle it On.

    Select the Bookmark from the Type drop down. Then Select the Page 1 bookmark we created.

    Repeat the same thing for Page 2. You have just created navigation buttons to the two views of your report pages.

    CTRL + Click in Power BI desktop will activate the actions on the buttons. Finally, you can see that you will toggle between the report pages on the single page. WHEW!

    Closing

    This was possible before visual grouping, but now it is an EXTREMELY clean and efficient way to consolidate your report pages and add a ton of objects into a single page. You do have a lot of objects on the page, but don’t worry there isn’t a performance impact because they don’t render until you click the button to make them appear. You can test this out by enabling the Performance Analyzer in the View ribbon.

    Visual grouping coupled with bookmark grouping have made these features fun to use and easily manageable for all. This is just a simple use case where extending the use of visual grouping to help us manage our reports better can make a world of difference as we build. I hope you enjoyed this post and that it helps you clean up any reports you may have that got a little unwieldy.

    If you like the content from PowerBI.Tips, please follow us on all the social outlets to stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel, and follow us on Twitter where we will post all the announcements for new tutorials and content. Alternatively, you can catch us on LinkedIn (Seth) LinkedIn (Mike) where we will post all the announcements for new tutorials and content.

    As always, you’ll find the coolest PowerBI.tips SWAG in our store. Check out all the fun PowerBI.tips clothing and products:
    Store Merchandise

  • Average Household Income Function in Power Query

    Average Household Income Function in Power Query

    This post will walk through how to pull an estimated household income from a US address. It will be completed all in the Power Query Editor. We will convert this to a function to reuse on any address we want.

    This is the second part in a series on free API calls. The first part demonstrated how to pull daily stock price from Yahoo! Finance, which is available here.

    Note: The content in this blog was first presented at the Power Platform Summit North America on October 18th, 2019.

    Introduction to the Data

    We cannot get exact income of a US address, but the US census releases data which is aggregated at different groups of households (called Geography Hierarchies).
    There are different levels of Geography Hierarchies, explained on the census website. The lowest level of granularity available for this data is Block Groups. This is a small group of blocks, and usually consists of about a few hundred to over 1000 people. A block group is expressed as a code.

    It is unlikely we will have the actual bock group code, but rather a street address. In order to retrieve information, we need to find which block group the address falls into. The first step is to convert the address into geographic coordinate, a process called Geocoding. You are probably familiar with using this feature – for example when you enter an address into a map app in order to get directions.

    The census.gov website offer a free service to do this (US Census TIGER). However, in my experience the match rate (percentage of addresses geocoded) is not as good as some other services – this means that some of the addresses you enter will not be found. There are many other companies that offer Geocoding services, such as Bing, who often provide better match rates. However, these tend to come at a cost. These can be used instead, but for this example we will focus on the free US Census TIGER service.

    Create an API Key

    The first step will be to sign up for an API key from the census website. API keys allow organizations to monitor usage and can stop overloading their databases with requests. Some can be used to charge for paid API calls, however the census API is free and only requires an email address. If you do not work for an organization, you can write “none”.

    Sign up here:
    https://api.census.gov/data/key_signup.html

    Storing the API Key

    Back in Power BI, on the home tab in Power Query, click Home, New Source, Blank Query.

    In the formula bar, Paste in the API key value you received. Rename the query to P_APIKEY.
    This will store the API key so it can be changed, but will not set it as a parameter and require it to be entered by the user every time they use the function.

    Setting up Parameters

    In the power query window, under the Home ribbon, Click the bottom half of the Manage Parameters button. From the drop down Select the option New Parameter.

    Name the parameter P_Address. Change the Type field to Text. Enter 15010 NE 36th St in the Current Value input box.

    Repeat this step 3 more times, so you will have 4 parameters in total. Use the below table for the names and default values:

    NameDefault Value
    P_Address15010 NE 36th St
    P_CityRedmond
    P_StateWA
    P_ZIP 98052

    Function Part 1: Geocoding

    On the home tab, Click New Source > Web. Switch to the advanced tab, Then in the open dialogue box, first Click the button Add part. This will add a new box. Repeat this to add 9 web parts. Afterwards, locate the first window and Enter part 1 of the URL. In the second box, Change the abc symbol to a parameter.  Fill in the boxes like below:

    1https://geocoding.geo.census.gov/geocoder/geographies/address?street=
    2P_Address 
    3&city=
    4 P_City
    5&state=
    6 P_State 
    7&zip=
    8 P_ZIP 
    9&benchmark=Public_AR_Census2010&vintage=Census2010_Census2010&layers=13&format=json

    Note: Do not enter the rows that begin with  P_ directly (rows 2,4,6,8). Switch the type to parameter and pick from the list.

    This will return a result: Record. Click on the Record value to drill into it.
    In the convert tab, click To Table to transform to a table.
    We have extra information here, but we are only interested in the blockgroup data. Filter the column Name to include the following rows only:
    “BLKGRP” , “COUNTY”, “STATE” , “TRACT”
    (make sure you keep the correct columns with these exact names).

    Now we have the correct columns, but for our function to waork we want them in one row. Highlight the Name column, navigate to the transform tabe and click Pivot Column. The symbol is:

    Expand the Advanced Options, and change the Aggregate Value Function to Don’t Aggregate.

    If you are following with the Microsoft head office, your data should look like this:

    Now that we have the address geocoded, we can find out census information.

    Function Part 2: Returning Household Income

    To add the second API call, we can take advantage of the custom column. It is actually possible to use Power Query (M) code in the custom column.
    Click Add Column then Custom Column.

    The code needed for the column is below. You can copy and paste this directly into the “Custom column formula” :

    Json.Document(Web.Contents("https://api.census.gov/data/2018/pdb/blockgroup?get=Tot_Population_CEN_2010,avg_Agg_HH_INC_ACS_12_16&for=block%20group:" & [BLKGRP] & "&in=state:" & [STATE] & "%20county:" & [COUNTY] & "%20tract:" & [TRACT] & "&key=" & P_API))

    Breaking this code down:
    Json.Document tells Power BI the value being returned is in JSON format, and to decode this to a list
    Web.Contents will tell Power BI we are going to be sending a web (api) query
    https://api.census.gov/data/2018/pdb/blockgroup?get=Tot_Population_CEN_2010,avg_Agg_HH_INC_ACS_12_16 is our base URL will some parameters. The parameters we’re giving are to return population and average household income
    -The second half of the URL takes in the location from the current row. anything in [Square Brackets] is a column. P_APIKEY is the parameter we set up earlier, that holds our API key

    This will add a new column holding a list of lists. Click on the word list to drill into it

    This will bring to the second level, two lists. Afterwards, Transform to a table by clicking on the “To Table” button in the ribbon, under list tools > Transform.
    After it is in table format, we expand the values to take them out the list. The data has two lists, the first is the column headers and the second is the values, so we need to transform a little to see the data in a nice format.
    Firstly, expand the values by clicking the expand button and select Extract Values.

    This will expand to one column, separated by a character of our choice. I’m going to use the carat symbol (^), as I’m confident this will not be a character already in the data. To do this, change the first box to –Custom– then type in the carat symbol.

    After extracting the data from the lists, we can split it into columns. We will split on the delimiter we added, the carat symbol (^). Click on Home Tab, Split Column, By Delimiter.

    Same as before, change the first box to –Custom– then type in the carat symbol. Leave the default setting of “At each occurrence of the delimiter”.

    Now it is split, promote the first row to headers by going to the Transform tab and use the “Use first row as headers”.


    Finalizing the Function

    As a result, this returns lots of columns. Highlight the Tot_Population_CEN_2010 and avg_Agg_HH_INC_ACS_12_16 column, right click and select “Remove other columns”.
    Rename the two columns to “Population” and “Household Income” by double clicking the column header and typing the new name.
    Finally, highlight both columns, enter the Transform tab and click “Detect Data Type” to convert the data type.

    Optional: If you want to add the original address in, Click Add Column then Custom Column. Enter the below code, which will concatenate the address to one value. You can name the column Address.

    P_Address & ", " & P_City & ", " & P_State & ", " & P_ZIP  

    Creating the Function

    This query uses a parameter which enables us to can convert it to a function. To do this, right click on the query in the Queries pane on the left and select make function.

    Now we have a function where we can input any address and return the estimated household income, as well as population of this average is taken from(n value). To check multiple addresses, you can add your function to any list. This can be found in Add Column ribbon, then Clicking the button Invoke Custom Function. This will return a table for each row. Before expanding, it is important to handle errors, otherwise it could break the query. One option is to Right Click the column header, and select the Replace Errors option, and Type the text null.

    Final Function

    For those who like M code, here is the final function. You can copy and paste this directly into the advanced editor (See this article on how to do this).

    let
        Source = (P_Address as any, P_City as any, P_State as any, P_ZIP as text) => let
        
                Source = Json.Document(Web.Contents("https://geocoding.geo.census.gov/geocoder/geographies/address?street=" & P_Address & "&city=" & P_City & "&state=" & P_State & "&zip=" & P_ZIP & "&benchmark=Public_AR_Census2010&vintage=Census2010_Census2010&layers=13&format=json")),
                result = Source[result],
                addressMatches = result[addressMatches],
                addressMatches1 = addressMatches{0},
                geographies = addressMatches1[geographies],
                #"Census Blocks" = geographies[Census Blocks],
                #"Census Blocks1" = #"Census Blocks"{0},
                #"Converted to Table" = Record.ToTable(#"Census Blocks1"),
            #"Filtered Rows1" = Table.SelectRows(#"Converted to Table", each ([Name] = "BLKGRP" or [Name] = "COUNTY" or [Name] = "STATE" or [Name] = "TRACT")),
                #"Filtered Rows" = Table.SelectRows(#"Filtered Rows1", each ([Name] = "BLKGRP" or [Name] = "COUNTY" or [Name] = "STATE" or [Name] = "TRACT")),
                #"Pivoted Column" = Table.Pivot(#"Filtered Rows", List.Distinct(#"Filtered Rows"[Name]), "Name", "Value"),
            #"Added Custom" = Table.AddColumn(#"Pivoted Column", "Custom", each Json.Document(Web.Contents("https://api.census.gov/data/2018/pdb/blockgroup?get=State_name,County_name,Tot_Population_CEN_2010,avg_Agg_HH_INC_ACS_12_16&for=block%20group:" & [BLKGRP] & "&in=state:" & [STATE] & "%20county:" & [COUNTY] & "%20tract:" & [TRACT] & "&key=" & P_APIKEY))),
            Custom = #"Added Custom"{0}[Custom],
            #"Converted to Table1" = Table.FromList(Custom, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
            #"Extracted Values" = Table.TransformColumns(#"Converted to Table1", {"Column1", each Text.Combine(List.Transform(_, Text.From), "^"), type text}),
            #"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "Column1", Splitter.SplitTextByDelimiter("^", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3", "Column1.4", "Column1.5", "Column1.6", "Column1.7", "Column1.8"}),
            #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", type text}, {"Column1.3", type text}, {"Column1.4", type text}, {"Column1.5", type text}, {"Column1.6", type text}, {"Column1.7", type text}, {"Column1.8", type text}}),
            #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
            #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"State_name", type text}, {"County_name", type text}, {"Tot_Population_CEN_2010", Int64.Type}, {"avg_Agg_HH_INC_ACS_12_16", Currency.Type}, {"state", Int64.Type}, {"county", Int64.Type}, {"tract", Int64.Type}, {"block group", Int64.Type}}),
            #"Removed Other Columns" = Table.SelectColumns(#"Changed Type1",{"Tot_Population_CEN_2010", "avg_Agg_HH_INC_ACS_12_16"}),
            #"Renamed Columns" = Table.RenameColumns(#"Removed Other Columns",{{"Tot_Population_CEN_2010", "Population"}, {"avg_Agg_HH_INC_ACS_12_16", "Houshold Income"}})
        in
            #"Renamed Columns"
    in
        Source

    If you like the content from PowerBI.Tips please follow us on all the social outlets to stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel.  Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.

    Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
    Store Merchandise

  • Dynamic Visuals using Buttons

    Dynamic Visuals using Buttons

    Sometimes, we want the users to see different metrics, but do not want to take up too much space on our page. The scenario we are going to walk through is how to build just one visual (in this case a bar graph). It will include a toggle that allows the user to select their desired calculation, either the sum of Volume, Dollars or Margin.

    Final Solution

    With buttons, we can change specific visuals on a page. Recently, with the release of conditional formatting on titles and backgrounds, we have some new methods to make this easier for the report author and cleaner for the report consumer.

    The Build

    Before we start, turn on the selection pane and bookmark pane. They can be turned on by clicking on the View ribbon and checking the correct boxes.

    First, we’re going to create our control table. This will be a disassociated table. This table should not have any relationships to any of the other tables in our model. We just need to enter a numeric ID and a description of what we want.  Click on the Enter Data button found on the Home ribbon. Enter the following data as shown. Click the OK button to close the Create Table dialog box.

    Now that’s set up, we can write our measure. This measure will see what is selected in the Number_ID column of our control table, then return the appropriate calculation. Use a switch statement to select the correct calculation. Create the following measure:

    Selected Calculation = 
    SWITCH(
      SELECTEDVALUE(Control[Number_ID])
       ,1,SUM(Sales[Volume])
       ,2,SUM(Sales[Dollars])
       ,3,Sum(Sales[Margin])
       ,SUM(Sales[Volume])
    )

    Note: See there is a default value listed in the switch statement. The default calculation means that if nothing is selected, SUM( Sales[Volume] ) will be returned. The default value is represented by the last property in the switch statement.

    Time to set up our visual. Add a bar graph with Category on the axis and the new measure, Selected Calculation, in the values fields. Then add a slicer for the Number_ID column. The Number_ID column comes from the control table we added earlier.            

    Switching the slicer can now change the graph to show the different calculations.

    The next stage is to add three buttons to the top of the graph. In the Home tab of the ribbon, click Buttons and select Blank. Make sure the outline colors and outline width match on all objects, Buttons and chart outline.

    Tip: Make sure you label your buttons in the Selection Pane. The selection pane can be turned on by clicking on the View ribbon and checking the box labeled Selection Pane. To Change the name of the button, double click the name listed in the Selection Pane. Giving a title (such as Button_Volume) will make it easily to see what visual items are on the page.

    After this, it’s time to add the bookmarks.

    The bookmark pane can be turned on by clicking on the View ribbon and checking the box labeled Bookmark Pane.

    Step 1:

    • Select a value of 1 in the Number_ID slicer.
    • Select the slicer (and only the slicer) in the Selection pane.
    • Click “Add Bookmark” in the Bookmarks pane.

    Step 2:

    • In the Bookmarks pane, right click the bookmark and rename it to Select 1.
    • Right click again, and untick “Display” and “Current Page”. Select “Selected Visuals”.

    Now repeat step 1 and step 2, but do so with the values of 2 and 3 from Number_ID slicer. Name these bookmarks Select 2 and Select 3. You should finish with three bookmarks, each that filters Number_ID to a different value. You can test the bookmarks by clicking on them once in the bookmark pane.

    On Button_Volume, assign the Select 1 bookmark (as Number_ID 1 refers to volume). To do this, click on Button_Volume in the selection pane. In the visualizations pane for this button, go to the property named “Action”. Turn it on, change the type to bookmark, and choose Select 1 in the dropdown.

    Repeat for Button_Dollars and assign Select 2. Then for Button_Margin and assign Select 3. Now the buttons can change the graph, but it’s a bit hard to see what is selected.

    Add Conditional Formatting

    This is where conditional formatting can help us! Select Button_Volume in the selection pane. Then in the visualizations pane, turn on the background property, select the ellipsis and click conditional formatting

    Here’s the settings we want:

    This is going to apply a rule if the Number_ID selected is 1, to give the button a blue background. As there are no other rules, any other number selected will default to the white.

    Now, apply the same steps to the other two buttons, but make the rule “If value is 2” for Dollars, and “If value is 3” for Margin.

    To tidy up, hide the slicer and turn the visual headers of all buttons off. You can click on the eye next to the slicer in the selection pane to hide it.

    Turn the visual headers off by clicking the button, then in the visualizations pane.

    Great! Now the tab shows the selected button and correct measure:

    To make it even clearer, apply conditional formatting to the title of the graph. On the graph, open conditional formatting. Set it to field value and use the type field in the control panel.

    Using this control table allows for greater flexibility. We can add more calculations, easily edit them or even sync across pages, all without having to re-record any bookmarks.

    If you like the content from PowerBI.Tips please follow us on all the social outlets to stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel.  Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.

    Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
    Store Merchandise

  • Icons upon Icons

    Icons upon Icons

    I am just bursting with excitement!! This month the amazing Power BI team has yet again come out with a great new feature, Icon sets. In addition to this you can enhance these icon sets by adding your own custom icons to your Power BI reports. Woo Hoo….

    So what does this mean? Well, now you have a new Conditional Formatting box found in the settings of the Table and the Matrix properties. To use a built in Icon from Power BI. Create either a table or a Matrix visual with some data.

    Select the visual and adjust it’s properties by clicking on the Paint Roller and opening the Conditional Formatting window.

    Scroll down until you see the toggle button for Icons. Turn the Icons On.

    Click on the Advanced Controls to set the properties of the icons based on the data properties. This type of dialog box should look familiar as it is similar to the previous boxes for conditional formatting. Opening this window shows Icons for each Rule in the list. To adjust an icon Click on the Drop Down Arrow next to the icon you wish to change. There are multiple icons to choose from.

    There are limited selections by default, but you can enhance this by adding your own icons with the custom Json theme files. At PowerBI.tips we love our theme files. They make using standard settings so much easier.

    Loading the Custom Icons

    For starters we have already done the hard work of creating an additional 50 icons for you to use in your reports. Download the Icon Theme File Here

    Update: Special thanks to Reid Havens from Havens Consulting for contributing extra icons to this Icon Set.

    With this file you get these additional icons:

    To add these additional icons follow these steps:

    1. Download the theme file -> Here
    2. Unzip the downloaded file to find the PowerBITips Icons v1.json file
    3. Navigate to the Home ribbon in Power BI Desktop
    4. Click on the Switch Theme button
    5. Select the list item Import Theme from the drop down menu
    6. The open file dialog box will open. Select the PowerBITips Icons v1.json file that you downloaded earlier.

    Boom, and just like that you have loaded your new icons. Now you can return to the icons for your table or matrix and adjust until your heart is content.

    Here is a sample of a table and a matrix with some custom icons applied:

    Update 2019/08/06: When publishing the Power BI file to the PowerBI.com service, the fill colors for the shapes need to have a %23 instead of a # (HASH) infront of the HEX codes. Thus, the format should look like fill=’%23FF0000′ instead of fill=’#FF0000′

    If you liked the tables from this blog they came from one of our Layouts that we produce. The Microsoft Layout September 2018, download it here.

    If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel.  Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.

    Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:

    Check out the new Merch!

    Hasta La Vista Data
    Go Ahead Make My Data
    PBIX Hat


  • The Dynamic Time Matrix

    The Dynamic Time Matrix

    Time and time again when I begin talking with Excel users and ask to see what current reports they are using, they usually show me a table with a mixed bag of columns split by different time ranges. A comparison of month over month, or year over year, mixed in with a few daily totals or cumulative totals all rolled up from values on other tabs to produce their preferred view (or dashboard). Typically, the first approach I take is to describe how we can break up this single table view of things and start looking at the aggregations of these values in easily digestible pieces and slice and dice them in different times ranges. I’ve explained that the goal should be to produce easy to consume visuals for comparison using measures and plotting these out in different ways to glean insights quicker. Most of the time, this works, but other times… it is second best to what the analyst or uber Excel user wants to see… they want to see their numbers, and they want to see them the same way they have them in Excel.

    The Challenge:

    Recently, I encountered this all too familiar scenario (Time Ranges in a table/matrix) except this time, I wanted to see if I could reproduce the output exactly as the end user wanted it rather than move them in a different direction.

    The first group of columns showed the days in the current week, the second group showed the weeks in the current month, followed by the Months to date, a year to date column and static columns of a Goal and Forecast.

    I’ll spare you the details of researching a better way than producing these as individual measures,  and suffice to say that I was able to come up with a solution based on a few calculated columns, a disassociated table, and a single measure to produce the output I was searching for.

    The Solution:

    The above screenshot is of the dynamic matrix that you can download from the link at the end of this blog. As I developed this solution it came to my attention that there are actually a couple ways we could build this solution. The first of those would be to have a time slicer drive all the different time ranges, this would be useful for analyzing older datasets in the different ranges, but my goal was to create a solution that follows the “Set it and forget it” train of thought. This solution will restrict the view of data to never exceed the current day, the neat thing is, the current day is when you read this blog, not a static point in time. I’ve pre-loaded data out to the end of 2020, so the sample should continue to work and change each time the file is opened.

    Before we dig into things, I want to convey that the DAX dove a bit deeper into the weeds than I initially expected, and I’ll do my best to describe what I did and why.

    The Data

    Sample Data

    I’ve modified my original solution to use a sample of Adventure works data that I created, this simple dataset consists of a column to group things by (ModelName), a date (StartDate) and the value to aggregate (ListPrice). This solution should cover a wide range of different use cases so don’t get hung up on the exact columns here. A grouping column, a date column and a value column are all you need.

    Here are the steps I took after creating the dataset and loading it into Excel:

    Load Data table from Excel into Power Query, Close & Apply

    Create a calculated date table (DAX):

    Date = 
    VAR MinYear = 2018
    VAR MaxYear = 2020
    RETURN
    ADDCOLUMNS (
        FILTER (
            CALENDARAUTO( ), 
            AND ( YEAR ( [Date] ) >= MinYear, YEAR ( [Date] ) <= MaxYear )
        ),
        "Calendar Year", YEAR ( [Date] ),
        "Month Name", FORMAT ( [Date], "mmmm" ),
        "Month Number", MONTH ( [Date] ),
        "Weekday", FORMAT ( [Date], "dddd" ),
        "Week Number", WEEKNUM([Date]),
        "Weekday number", WEEKDAY( [Date] ),
        "Quarter", "Q" & TRUNC ( ( MONTH ( [Date] ) - 1 ) / 3 ) + 1
    )

    Your MinYear / MaxYear will obviously be different, but the core columns for what we need are in this output.

    Add Calculated Columns

    Now we need to add some filter columns to the date table we just created in order to get the current time frames we care about.

    IsInCurrentYear = if(YEAR(NOW())= [Calendar Year],1,0)
    IsInCurrentMonth = if([isInCurrentYear] && MONTH(NOW())=[Month Number],1,0)
    IsInCurrentWeek = if([isInCurrentYear] && WEEKNUM(NOW())=[Week Number],1,0)
    

    Create a Disassociated table (Dax Table)

    This is our grouping table, this is the first key element in which we create a series of different DAX calculated tables to create the different time range groups we want to roll up our aggregate amount by. In each case, we are pulling all current and previous years, the current months in this year to date, the current weeks in the current month and the current days in the week. Then we union those values together where the “Group” is the top level time range, and the value is the specific time range values. Then we add an index column so that we can order the values in the way that we want.

    The final output should look something like this:

    This is the DAX code to create the calculated table. Each “Summarize” creates the time groups and values rolled up for the particular time range we are interested in. This is wrapped in the “AddColumns” function to add in a workable index that allows us to order all the values in the correct order dynamically. Initially, the static Index column works to sort the Group column, but the dates won’t sort as Calendar dates so I added the second way to dynamically generate an index to sort the values by. I retain the original Index value and ensure the counts returned from the date table align in sequential order. Essentially retaining the Group/Value index to sort by. Then we wrap all that in “SelectColumns” so that we can specify the column names. If we didn’t do this, the first column name would be “Calendar Year”.

    TimeRange = 
    SELECTCOLUMNS(
    UNION(
        ADDCOLUMNS(
        SUMMARIZE(FILTER('Date', 'Date'[Calendar Year] <= YEAR(NOW())), 'Date'[Calendar Year], "Group", "By Year", "Index", 4),
            "DayIndex", CONCATENATE(4, FORMAT(CALCULATE(COUNT('Date'[Date]), ALL('Date'), FILTER('Date', 'Date'[Calendar Year]<=EARLIER('Date'[Calendar Year]))),"000"))
                ),
        ADDCOLUMNS(
                   SUMMARIZE(FILTER('Date', 'Date'[Month Number] <= MONTH(NOW()) && 'Date'[Calendar Year] = YEAR(NOW())), 'Date'[Month Number], "Group", "By Month", "Index", 3),
            "DayIndex", CONCATENATE(3, FORMAT(CALCULATE(COUNT('Date'[Date]), ALL('Date'), FILTER('Date', 'Date'[Month Number]<=EARLIER('Date'[Month Number]))),"000"))
                ),
        ADDCOLUMNS(
                   SUMMARIZE(FILTER('Date', 'Date'[IsInCurrentMOnth] = 1 && 'Date'[Week Number] <= WEEKNUM(NOW()) && 'Date'[Calendar Year] = YEAR(NOW())), 'Date'[Week Number], "Group", "By Week", "Index", 2),
            "DayIndex", CONCATENATE(2, FORMAT(CALCULATE(COUNT('Date'[Date]), ALL('Date'), FILTER('Date', 'Date'[Week Number]<=EARLIER('Date'[Week Number]))),"000"))
                ),
        ADDCOLUMNS(
            SUMMARIZE(FILTER('Date', 'Date'[IsInCurrentWeek] = 1 && 'Date'[Date] <= NOW()), 'Date'[Date], "Group", "By Day", "Index", 1),
            "DayIndex", CONCATENATE(1, FORMAT(CALCULATE(COUNT('Date'[Date]), ALL('Date'), FILTER('Date', 'Date'[Date]<=EARLIER('Date'[Date]))),"000"))
                ),
                   DATATABLE("Header", STRING, "Group", STRING, "Index", INTEGER, "DayIndex", INTEGER,
                       {{"Goal", "Overall", 5,0}, {"Forecast", "Overall", 5,0}})),
        "Value", 'Date'[Calendar Year], "Group", [Group], "Index", [Index], "DayIndex", [DayIndex]
    )
    

    Create a relationship between the Date table and the Data Table

    This would be on ‘Date’[Date] and ‘Data’[StartDate]

    Create our Measures

    Now we need to take the grouping table and merge it with the aggregated value via our measures. In the Data table we want to create the following measures.

    First Measure:
    List Price = SUM(Data[ListPrice])
    
    Second Measure:
    TimeValue = 
        VAR Val =
        SWITCH(SELECTEDVALUE('TimeRange'[Group]),
            "By Year", CALCULATE(TOTALYTD([List Price], 'Date'[Date], FILTER('Date', 'Date'[Date]<= TODAY())), FILTER('Date', 'Date'[Calendar Year] = VALUE(MAX('TimeRange'[Value])))),
            "By Month", CALCULATE(TOTALMTD([List Price], 'Date'[Date], FILTER('Date', 'Date'[Date]<= TODAY())), FILTER('Date', 'Date'[Month Number] = VALUE(MAX('TimeRange'[Value])) && 'Date'[Calendar Year] = YEAR(NOW()))),
            "By Week", CALCULATE(SUM(Data[ListPrice]), FILTER('Date', 'Date'[Week Number] = VALUE(MAX('TimeRange'[Value])) && 'Date'[Calendar Year] = YEAR(NOW()) && 'Date'[Date]<= TODAY())),
            "By Day", CALCULATE(SUM(Data[ListPrice]), FILTER('Date', 'Date'[Date] = DATEVALUE(MAX('TimeRange'[Value])))),
            --Remove SWITCH below if you only want time range
            SWITCH(SELECTEDVALUE(TimeRange[Value]),
               "Goal", [List Price] * 1.2,
               "Forecast", [List Price] * RAND() 
                )
        )
        RETURN
            FORMAT(Val, "CURRENCY")

    Create the Matrix

    Create a Matrix visual and drop the columns into the following rows and columns:

    You will have something that looks like this:

    Dynamic Time Matrix First Level

    Are you ready for the magic? Head over to the far right of the visual and click down on the “Expand all down one level in the Hierarchy” button ->  and BOOM!

    Dynamic Time Matrix Complete

    We have our fully functional time range matrix that will adjust dynamically based on the current day. No need to update, change or alter anything! I hope you enjoyed this tip, I certainly was excited to put this solution together. There are so many different ways you could alter this solution, using different dates (swap in fiscal calendar dates), add different final total or percentage columns at the end, my mind keeps coming up with new solutions, and I hope you can use this as well!

    You can find the full solution in this PBIX download which includes the sample data set.

    If you like the content from PowerBI.Tips, please follow us on all the social outlets to stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel, and follow us on Twitter where we will post all the announcements for new tutorials and content. Alternatively, you can catch us on LinkedIn (Seth) LinkedIn (Mike) where we will post all the announcements for new tutorials and content.

    As always, you’ll find the coolest PowerBI.tips SWAG in our store. Check out all the fun PowerBI.tips clothing and products:
    Store Merchandise

    After many requests, we are now selling out layouts unbranded so that you can use them in all your business applications. Be sure to check out our first offerings and stay tuned for more to come in the future. Learn more about Layouts.

  • Quick Access Toolbar for the Win

    Quick Access Toolbar for the Win

    I’m a lazy engineer.  Let me qualify my statement.  In lazy I mean I like to find the path of least resistance, the shortest distance between two points.  Everyday I challenge myself to be lazy, or efficient how ever you want to view it.  As I have built many reports in Power BI over the years here is a fantastic trick, I use almost every day, Customizing the Quick Access Toolbar.

    Here are a couple reasons why I think this will speed up your report writing.

    • There are only a few shortcuts that I am aware of for Power BI Desktop, thus making your own shortcuts with Hotkeys is faster for repetitive tasks.
    • To achieve a simple task, you might have to jump between ribbons, again adding time.
    • When you set up Hotkeys you don’t have to remove your hand from the keyboard and wiggle your mouse around then come back to the keyboard.  Again, wasting time.

    Enough reasons, if you are still reading this then clearly you are lazy like me.  Let’s just get to the good stuff…

    By default, you get the following Quick Access Toolbar:

    The icons are Save, Undo, and Redo.

    While these icons are good, YOU DON’T NEED THEM… lol

    You can automatically save by using Ctrl + S

    Undo is simply Ctrl + Z

    And Redo… lets be honest no one uses this one.

    Another aspect of the Quick Access Toolbar is when you hit the Alt key you can reveal numbers on the toolbar:

    Pressing the number or letter triggers the next button press. 

    Example:

    • Alt + 1 will automatically save the file

    To take this further you can string together multiple key presses to dig even deeper into the menus

    Example:

    • Alt + H + ii  brings up the import image dialog box
    • Alt + G + D  opens the menu to get data
    • Alt + W + C  Opens the Selection Pane,  Repeating this command closes the Selection Pane

    The downside with multiple commands it takes more time to learn the key strokes to be fast.  As a personal preference I like to use one-step key press options (Ctrl + s or Ctrl + z).  It is easier for my simple mind to remember and commit to memory.  If you use Adobe products for images or video, you will be familiar with this technique.  From my opinion Adobe has some of the best most useful shortcuts that enhance productivity.

    Make it Custom

    Let’s begin customizing our menu. 

    First Click the Down Arrow at the far right of the toolbar.

    Click on the item in the dropdown menu called Show below the Ribbon.  This will move the toolbar to the bottom of the ribbon.

    For each item in the dropdown list Uncheck each item, Save, Undo, and Redo.  This will remove all the items from the toolbar.

    The Quick Access Toolbar will now look like the following image:

    In our next step we need a hidden toolbar to appear, the Format ribbon.  This Ribbon only appears when multiple elements are on the page.  Thus, we will need to add some generic shapes to the page to reveal the toolbar.

    Add three Shapes (Squares) to the report page.  Click on the Home ribbon and select the Shapes icon listed in the Insert section of the ribbon.  Then Select the item in the drop-down list labeled Rectangle.

    After adding one rectangle select the rectangle with your cursor.  Use Ctrl + C to copy the shape.  Then, use Ctrl + V to past Two more rectangles on the page.  Use your cursor and move the shapes across the report page.  The order of the shapes does not matter, they just need to be distributed across the page. See below for reference.

    Use Ctrl + A to select everything on the page.

    Notice a new ribbon appears, the Format ribbon.  This is called a context aware ribbon.  This has been a long standard best practice in office products.  Only show the ribbons that are needed.  Thus, the format ribbon and the Data / Drill ribbons are not exposed until you have visuals selected on the page.

    Click on the Format ribbon.  Click the button called Align in the Arrange section of the Format ribbon.  Then Right click on the first item in the align menu called Align left.  Upon doing this, a menu will appear.  Select the first item in the list called Add to Quick Access Toolbar.

    Repeat the same process by adding the Distribute Vertically action from the Distribute button on the Format ribbon.

    Next, Add the Align top action from the Align button on the Format ribbon.

    Finally, Add the Distribute horizontally action from the Distribute button on the Format ribbon.

    Using the combination of Aligning an Edge / Distribution is just so much faster then moving one object at a time. 

    For example, here is a random arrangement of 5 shapes on a page.

    Using our newly created shortcuts I select the Items I want to move.

    Then using our new key combo, Alt + 3, Boom all the top edges are aligned.

    Then the magic, press Alt + 4 and all the items are evenly distributed

    Superfast and efficient, aka lazy..

    Side Note:

    When I am training new users in building Power BI reports, I like to point out the following, it is important to align your elements on the page.  This follows along with one of the Gestalt principles, symmetry.  Your eye can perceive slight differences in objects that are misaligned.  I can’t tell you the number of reports has something like the following:

    The change is subtle but your eye picks it up.  When these out of alignment objects are near another visual with a straight edge it is even more apparent.

    (Steps off the Soap Box) Ok, enough diversions.  Let’s finish with adding two more items that I use every time I build a report, Selection Pane, and Bookmarks Pane.  We can add these items to the menu as well. 

    Navigate to the View ribbon (or hit Alt + W if you want to be fancy).

    Right Click on the item called Selection Pane.  Select the item in the dropdown Add to Quick Access Toolbar.

    Do the same for the Bookmarks Pane.  When you are finished your Quick Access Toolbar should look like the following:

    You may be asking yourself… So why did we move the menu to the bottom of the ribbon?  We could have just left it on the top of the screen.  You would be right.  But, I do want to point out one odd behavior when the Quick Access Toolbar is at the top of the ribbon. 

    When I have multiple visuals selected on the page the contextual menu appears.  See below image with the Quick Access Toolbar at the top:

    When this happens any items to the right might get chopped off, and you must access them using the double sideways arrow.  The Alt + # keys will still work even though the items are hidden, but I don’t like the experience of having some of my menu items hidden.  If you had many icons distributed across the Quick Access Toolbar, say 9 of them, you would have to remember its position in the alt keys.  This is the reason why I prefer to show the Quick Access Toolbar below the ribbon.  When the context aware menus appear the Quick Access Toolbar is not covered.

    Thanks for reading along.  Have a great day and I hope this tip / trick makes you a little bit more productive!

    If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel.  Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.

    Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:

    Check out the new Merch!

    Hasta La Vista Data
    Go Ahead Make My Data
    PBIX Hat


  • Make Custom Visuals with no Code

    Make Custom Visuals with no Code

    Welcome to another installment of building custom visuals with the Charts tool from PowerBI.Tips. In this edition we make the following custom visual.

    Custom Ribbon Chart

    This chart comes to us from the sharp mind of Nick Snapp, Check out is work on Charts.PowerBI.Tips within our custom visual gallery. This chart combines the ability to see both the relative size of values between states as well as distributions of data with adjacent number lines. Pretty cool don’t you think?

    Below is the walk through video on how to build this custom chart.

    Building the Custom Visual

    If you want some other help making custom visuals check out this other tutorial building a simple bar chart.

    If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel.  Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.

    Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:

    Check out the new Merch!

    Hasta La Vista Data
    Go Ahead Make My Data
    PBIX Hat


  • 2019 Microsoft Business Application Summit Retrospective

    2019 Microsoft Business Application Summit Retrospective

    This year the Microsoft Business Application Summit (MBAS) was held in Atlanta Georgia. Despite some travel snafu’s (3 rebooking’s and 9 delays), we made it into Atlanta late the night before the preconference sessions. Which was good, because we were presenting one!

    (A special thanks to Adam Saxton (Guy in a Cube) who went way out of his way to pick up a bunch of materials we needed for the preconference. If you don’t follow Adam and his awesome Power BI channel, be sure to check it out -> YouTube Link Guy in a Cube)

    Our “Data visualization with Power BI” preconference session was packed with 180 people and we had a fantastic time showing people how to build no-code custom visuals with the new “Charts” http://charts.powerbi.tips/ (Gallery here: http://gallery.powerbi.tips/) tool based on the Microsoft Research team that developed Charticulator, how to create themes and layouts and many other tips and tricks. The good news for all our followers on powerbi.tips is that we have that content created now and we will be sharing that over time in the form of blogs and other training materials posted to the site.

    We each individually had the opportunity to spend some quality Q&A time in the Community Lounge with some great one on one time with many of the conference goers. And we finished off the whirlwind tour with the final session time of the conference where we presented the “Microsoft Power BI: Data visualization best practices”. Here is our session from the conference.

    Here is a detailed video of the creation of the custom ribbon chart at the end of the session:

    Link to Session BRK 3023 on YouTube

    All the sessions of MBAS can be found in the Power BI Community Video Gallery

    Top Takeaways:

    The best part of any conference is the people you meet. The social aspect and meeting new people are one of the most important aspects of any conference event. We hope all the attendees at MBAS made some great new connections, we know we did!

    It is an exciting time to be in the business of data, and the MBAS conference has merged in Dynamics with the Power Platform tools. The keynote by James Phillips brings to light Microsoft’s next steps in the evolution of how these tools are transforming businesses, and the future is bright indeed. Be sure to check out his Keynote

    Power BI is still on a rocket ship of greatness. The roadmap is exciting, the community is growing bigger and better every day, and more and more businesses are leveraging the tool to change the way their users interact with data on a daily basis.

    Our Favorites:

    Of course, our favorites all revolve around the tool we love, Power BI! An absolute must watch video is the road map session that outlines the near term features that are going to amaze you

    Link to road map session

    We’re huge fans of Power BI dataflows, so of course we recommend those sessions. Here is a Great Overview and explanation dataflows.

    Want more information on dataflows, check out these sessions from the conference.