The Milwaukee Crew is back at it again with the October 2020 Power BI User Group (PUG). This month we have the amazing Gil Raviv talk to us about Power Query and the Enterprise. For those of you who don’t know Gil he is a superb Power Query Expert.
Gil talks to about Power Query in different enterprise domains. Learn which tools to use and which ones are not quite ready for prime time. You will learn a ton in this great session.
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:
Daniel Marsh-Patrick is a custom visual developer who recently released the HTML Content, a custom visual. This month we go over this visual in detail with it’s creator himself.
While this visual is currently at V1, Daniel shows us a preview of V2 and trust me you will absolutely love it. I’m so looking forward to using this visual in my daily workflow. As well as V2 is going to be amazing.
If you like Daniel’s work please consider sponsoring him. This way we can continue to get amazing visuals: https://github.com/sponsors/dm-p
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:
Thanks for your interest in our product Scrims. For more details on what is a scrim click this link to Learn More.
Download a scrim from the products page. You can access all the available scrims here.
Instructions
After downloading, you will have a Zip file stored on your computer. Right Click on the zip file and Select the option Extract All from the drop down menu.
The extract compressed folder menu will appear. Click on the Extract button found in the bottom right corner of the menu.
A new folder will be extracted to the location noted in the previous menu screen. Open the newly created folder. Within this folder you will find all the images for the Scrims and a JSON theme file to use within your report.
When working with scrims it is helpful to see which image contains the the correct background layout for each of your pages. I find that it is helpful when reviewing images as Extra large icons. To turn this on, Open the View ribbon in the File Explorer. Then in the Layout window select the option titled Extra large icons.
Add Scrims to Report
Open a Power BI report in the Power BI Desktop application.
Note: Reports do not necessary have to be brand new. You can use scrims on existing reports. For illustration purposes an existing report was opened with only visuals. The remainder of this tutorial will show you how to add scrims to a pre-developed report.
Click on the Paint Roller button. Then Open up the Page background item in the menu options. Click on the option labeled Add image.
Note: for these options to appear you have to have a report open and none of the visuals selected on the page.
In the open file selection dialog box pick the scrim that you want to load. Click on Open to load the image to the report page.
The image will not initially appear. This is because the default settings for background are set incorrectly for this feature. Change the transparency to 0% and adjust the Image Fit to the drop down option of Fit.
Note: Images provided in scrims are larger than the report page pixel size. This is because in order for the images to not look blurry we have to supply a larger image. The Fit feature then scales the image back down to the report canvas size but retains a crisp and clean look.
Our report should now look similar to the following:
Add JSON Themes
Initially the visuals will not be formatted for the style of the report. We can control this by using a JSON theme file to pre-format some options for the visuals.
On the View ribbon, select the Drop Down Arrow icon. Then Select the option at the bottom of the menu titled Browse for themes…
Navigate to the scrims download folder and add the supplied theme with scrim download.
This will apply formatting for the colors and some Visual style properties.
Clean up Visuals
Next Select individual visuals and Align them to the defined areas within the scrim.
See sample image below with visuals aligned to the scrim.
Finalize Report
Apply any additional style properties for your visuals. In the below image the following settings are added for reference:
The top 4 cards are grouped and the group
The Grouped cards were applied a background of white @ 40% transparency
Labels were added to the bar charts
Unneeded axis were removed from the bar charts for clarity
White lines were added to the scatter chart for x and y axis
Then rinse wash and repeat for every other page you need to develop.
For this week we are building a stacked bar chart on https://Charts.PowerBI.Tips. While you can build this type of chart within Power BI Desktop this video is more of an example showing how you can build a similar custom visual chart. There are two areas that i’d like to point out.
When working with a chart you can add a Legend to a shape object (2:40)
Adding a grand total requires an additional Glyph (3:14)
While these two tips are pretty simple it really does help you when building more complex custom visuals.
Watch the Tutorial
Download this Custom Visual
If you liked this visual and want to download it, head over to this repository to download.
Learn More About Custom Visuals
We have been working hard to help you learn how to make custom visuals. Check out our full YouTube Playlist to learn more about using Charts.PowerBI.Tips.
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:
We are starting today off with a fun chart. We will be making a filled donut chart. Typically, I don’t use donut charts but in this case I think we have a good reason, and it’s delicious…
The data being used in this visual varies from o to 100%. This could be something like a test score or a compliance number. Thus, we will be using the donut chart to represent a completion of 100% or some variant below.
Video on how to build this chart.
During this video we used a couple measures. They are the following:
Measures
Average Product Score = AVERAGE( 'Product Scores'[Score] ) / 100
Average Product Score Inverse = 1 - [Average Product Score]
Where the value of the Score comes from the Product Scores table. The Score column ranges from 0 to 100%. If you like this visual and want to download a sample file visit my GitHub page.
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:
This post will answer how to sort a measure that returns text values to a custom order, without affecting other columns. It will utilize the DAX functions of REPT() and UNICHAR(8203) – a Zero width space.
The requirements
I’ve been working at a florist! In this example, I have been in charge of looking after four plants, named A, B, C and D. The florist owner is a big Power BI fan, and asked me to measure how much water I have been giving them a day to put in a report. They need at least 20ml to survive, but over 50ml will stop them growing as well.
Create a table with the flowing: The flowers get under 20 ml, label as Bad. When the flowers get 20 – 50 ml, label as Good. Finally, if the flowers receive over 50 ml, label as Warning. I’ve been asked to show them in order of Bad, Warning then Good. This is vital so the plants needing attention are at the top of the table.
Creating the table
Here is the measure I create:
Adding this to a table:
Now comes the question, how can I order this to put Bad and Warning together? If I order by Water Target measure, this will be alphabetical. Sorting by WaterIntake can not give me the correct order either. One option would be to make a conditional column and use the “Sort by Column”. However, this may be a complicated calculation, especially on more complex measures. In addition it will sort every visual by this column, when I only want to sort in this one table.
Creating the custom sort
My solution? Make use of the UNICHAR() function. For those unaware of this function, UNICHAR() can return characters based on their UNICODE number. This can include more text characters not included on the standard keyboard.
A character that can help is UNICHAR(8203). This is a “Zero width space”. This is a space that has not width, so it is essentially invisible and will not be visible in the measure. The Zero width space is still recognized as a character by DAX. Spaces come before any letter in the alphabet. Two spaces comes before one, and so on.
The second function I will utilize is REPT(). REPT() or replicate, simply repeats text multiple times. It takes two arguments, the text and the times to repeat.
For example: REPT( "Hi", 3 ) will return the text "HiHiHi"
To change the sort order, I will repeat the Zero width space in front of the text. The text I want to appear first will have the space repeated the most amount of times. This will put it first in an alphabetical list. I will use the & symbol to concatenate the Zero width spaces and the text.
Now, “Bad” has the Zero width space repeated three times in front of it. This now puts it first in an alphabetical list. Warning has the Zero width space repeated twice, putting it second. “Good” has it once putting it third.
Applying the sort
Now I can arrange my table by Water Target (alphabetical), in an ascending order:
And success! I’ve added a custom sort to my text measure, without making any other measures or columns.
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:
I recently encountered a
really frustrating experience related to a set of reports seeming to not update
after some data source changes. I’d done this change before, and had another
co-worker take on the task of updating some of the other reports in the same fashion.
After a bit he reached out and explained that a few of the reports wouldn’t
update while the others had… This was odd since we were making the same type of
change. Queue hours of testing, changing, fixing one report without any idea
how I did it, and then hitting a brick wall with the remaining two.
The Setup: The data sources for the
original reports were Excel spreadsheets stored in a SharePoint Online folder. The
PBIX file connected to Excel files in SharePoint online using a Web connection.
Once the reports were created, we stored the PBIX files in a separate
SharePoint Online folder. Next, we opened the Power BI Service and connected to
the reports directly from Power BI to a SharePoint team site, if you aren’t
familiar with that process you can read about it in depth in an article that
Mike Carlo wrote -> here. (The TLDR
-> Get data -> Files -> SharePoint Folder -> navigate to folder ->
Click on PBIX -> Connect)
By connecting to the PBIX files from the PBI Service the dataset, report and dashboard for the report are loaded and sync’d. Where this comes in very handy indeed, is linking the SharePoint folder to your windows explorer and accessing the file, making changes, and saving the PBIX in that “local” location no longer requires you to re-publish the report from the PBIX and the changes make their way to the Service without any further work. I had made several changes to the reports from an asthetics perspective, and maybe added a new measure here and there, but hadn’t done anything drastic until just recently when we updated the sources. Due to some changes on the backend processes that were generating the Excel files, it became apparent that it would be easier for the Dev team if we used CSV files instead of xlsx. The team went through and changed the reports and 3 of the 5 reports we were working on broke in the Service giving this error.
At first, I thought it was the use of parameters in the report, but after determining that wasn’t the issue, it actually helped me figure out that the report in the Service wasn’t updating because the parameters were still showing the “xlsx” file type from the files that I had already removed from the SharePoint location. After repeated attempts to change the datasources manually in the original file, delete and replace, and every other combination of things to try a refresh, I was stumped. What was more confusing, is that connecting to the file again from the PBI Service created another dataset & report of the exact same name!
In my mind, that wasn’t
supposed to happen, and I was getting more frustrated because things were not
behaving as I would expect. My initial assumption here was that the PBI Service
would look at the new PBIX of the same name and recognize the changes and
replace the existing dataset and report, the same way that it does if I
manually push a PBIX via the “Publish” action. But using this direct connect
method, refreshing the dataset did nothing…(cue the “grrrr”).
The solution:
Thanks to the fantastic Power BI team, they were able to determine my issue and share with me the root cause of some of the datasets not updating. The issue is that when you connect to the PBIX files in this manner, the PBI Service looks at the root id of the PBIX file in the OneDrive location and that file id cannot be deleted and replaced with another one. If you do that, you get the above error on the dataset source because it cannot find the file id. If you remove the file out of SharePoint then when you insert it back into the folder the ID will be different. This is what breaks the dataset in Power BI, and also the reason it allows what appears to be the same named dataset and report. However there is good news, because you are in SharePoint you will be able to go back in version history of the folder and pull the previous versions of the reports and resolve the issue in the datasets. I did end up having to replace one of the reports, but lucky for us it was only a single user for the customer report and re-sending a shared link was a really low impact compared to what it could have been.
Here are the following
guidelines I can offer up after going through this.
Do:
Sync the SharePoint folder to your local storage
Open the report directly from the synced folder and update it in location
Leave the originals file in the folder and replace it with the new one
Do try to resurrect your previous version of the report PBIX in the folder (if you are hitting this issue now)
Don’t:
Move the file to your local machine, then back to the SharePoint folder
Remove the file from the folder (You can do this if you move it to a SharePoint folder, update and move it back, but if the dataset refreshes during that time in the Service it will break and you will need to fix the credentials when you have put the file back.
I hope you found this post
worthwhile, error messages are hard to track down to the root causes and due to
the nature of this being a tricky one for me to solve I thought I would share
the experience and hopefully help others avoid it or solve the errors that
match above.
When testing out this issue again, I did
uncover this error message which is much more specific. It came up after I made
the breaking change, but prior to an automated refresh.
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: