aggregating data in power bi query editor - powerbi

I have gone through this tutorial
https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-tutorial-analyzing-sales-data-from-excel-and-an-odata-feed/
and was having some issues at Task 4 - Step 1 that I have somewhat resolved but would like to find a better way to complete the task.
The issue of this is that the title of my graph is Sum of UnitsInStock by ProductName but I just want it to be "UnitsInStock by ProductName".
See image below:
Sum of UnitsInStock by ProductName
I think the issue is that in the tutorial link it has the "UnitsInStock" column is aggregated already (which you can see in the field pane) whereas I had to aggregate the data myself. I think to fix this I just have to aggregate the data in the query editor but I haven't been able to figure out how to do this.
If someone could point me in the right direction that would be great!

The button you want is Group By - it's on the Home ribbon in the central Transform section.
Select your grouping columns before hitting it, to preload them in the Group By window. I haven't followed that tutorial so you will need to decide what to select. Any column you don't select for Group By or aggregate (see below) will be removed by this Step.
In the bottom section of the Group By window, click the + button to add an aggregation, then choose Sum and choose your column (e.g. UnitsInStock ). You have to type the output column name.

Related

Power BI | Collapse and expand lengthy values in one column

I have a column with lengthy values in my Power BI table. I would like it to only show a part of it so that the table isn't hard to navigate, and once the viewer clicks or do something, then it shows the whole value. Is there a way I can accomplish this?
There are posts about collapsing/expanding the whole column, as in keep it disappeared and then appear once you expand or vice versa, but I can't find a way to collapse/expand each values.
Following is an example. As you can see, "Bio" column is very lengthy, so I would it to show maybe a few lines in original view, and once the viewer wants to see the full Bio of that authors, then they can by a click or any action.
Any help would be much appreciated!
OriginalTable
What I want
You can add a column with the truncated version, and a Drill Through to a report page for that single bio.

PowerBI - Is there possible to have 2 dropdown values that are applied to the entire column?

I want to implement on PowerBI a calculator that I developed in Excel.
Basically, it works this way:
I have a list of Dates:
I have a Database that combines in a key the name of the source with a date:
I have a calculation table where I apply into a Dropdown menu value an entire column, it combines with the Source, forming a key, where I can calculate the Source variation choosing two dates (an initial and an end date).
I would like to know how can I apply it into Power Bi, specially step 3. With a Dropdown menu that is applied to an entire column "dynamically"
You can do this with Calculation Groups. To use them, you have to use the free external tool Tabular Editor.
Setting dynamic date ranges like this is a very common use for Calculation Groups.
Here's an example of a prior year Calculation Item:
CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR(cal[date]))
You can create multiple Calculation Items to define all the various periods you need.
You can then set the calculation group as the field for a dropdown menu, and each calculation item you defined will be an option in the menu.
Here's an intro article. This same website has the best training on calculation groups you can find online. (And it's all free.)

Showing a visualization with Parent Child/Successor Predecessor relationship

I wanted suggestions from the community as to which chart should be used to depict the Parent-Child/Successor-Predecessor relationship in Power BI. I'm using Azure boards as a data source. Here is my sample data source.
I want to show each work item id in the center and its Predecessor on the top left and successor on the bottom right. With that, I want to arrange my items based on iteration.
Here is how I'm trying to visualize my data.
I don't need links to the Microsoft Custom Visuals Page. I know that it exists. I'm expecting somebody to point out to a visual in the market place that could help me with my scenario.
Not sure if there any exact option for data presentation as per your design/requirement or not. But to serve the purpose, you can try with "Multi-row card" and the presentation will be something like below-
You can apply some Styling in the visual, but it will not like your sample requirement I guess :(
Here 2 column is basically 2 different "Multi-row card" visual.
In first visual, applied filter with Iteration = 1
In second visual, applied filter with Iteration = 2
For better presentation purpose, I replaced NULL value with a "-" in column "Predecessos ID" & "Source ID Title"

How to add multiple fields in columns of Power BI matrix and view them without drilldown

I've trying out Power BI to solve some visualization problem in my organization and I've been working on desktop version of Power BI to try out its features.
I'm stuck at few issues and cannot find our way out of this.This is a sample view I've been trying to create:
Figure 1:
1
We've a dataset containing Product Opinion across gender, Age Group, Geography etc. and we want to pivot the opinion across different parameters as shown above.But when we use Matrix view of Power BI and add two parameters in columns, it creates a drill down view as shown below:
Figure 2: 2
On adding multiple fields in the column section we get an option to move down to next hierarchy as shown below:
Figure 3:3
Although we have the option to move down to hierarchy ,we are unable to show then side by side as we've shown in Figure 1.
Is there a way we can get the visualization as given in Figure 1 ?
Also, Currently the columns and rows are automatically sorted alphabetically. Is there a way we can adjust the column and row position as per our needs?
To sort the rows in a custom order, you will have to create an index table. The below link walks you through the steps involved:
http://www.excelnaccess.com/custom-sorting-in-power-bi/
Now, to achieve the visualization you are looking for, the only way I can think of is to create two matrix visualizations (One for gender and other for age group) and place them in such a way, that it gives the illusion of the same table. There might be a better way to do this, but I these workarounds work just fine. Hope this helps.

In Query Editor, how to get details of a step?

I've done some basic things in a query editor via the user interface. For instance, I renamed a column. Now I'm going back to review, but I'm having a hard time figuring out where the details of the step are.
In Applied Steps, on the "Renamed Column", I can right click and go to properties, but it does not list the old and new column name. There is no gear/setting icon to the right. How do I figure out what the new and old column names are?
For the "remove top rows" step, I can click on the gear icon to the right, and get a box with the number of rows, and edit it. How can I do the same with other steps such as renaming columns?
Not all commands have a gear icon in the Applied Steps panel. The Advanced editor can be quite overwhelming at first.
To ease into things, go to the View ribbon and ensure that "Formula Bar" is ticked, like in the screenshot below. Now you can select a step in the Applied Steps panel and its formula shows in the formula bar, very much like in Excel. You can edit the formula and change parameters as you see fit.
You can expand the formula bar to show a few more rows, with the icon at the right of the formula bar.
The code behind the Query Editor is Power Query. Microsoft Power BI ports many useful / frequently-used functions to the user interface for easier / better user experience (but not all functions, obviously).
Therefore, if you want to find the details of a step, you can always go to the Advanced Editor and check out the original Power Query code to find the corresponding line of code. You can also modify the code directly if you understand Power Query.
Below is a screenshot of the Advanced Editor, where the Table.RenameColumns function in Power Query is highlighted, which is the same as Rename Column in Power BI: