I have a dataset of products and the categories they belong to. Each product can belong to 1 or more categories (C1, C2, etc).
My goal is to generate a bar chart in Power BI to count how many products belong to each category. Something like this:
This is very easy to do in Excel but I just couldn't figure out how to do that in PowerBI... The closest I got was using a clustered column chart. But everything was crammed in the center since I only have one "cluster".
I feel I'm missing something very basic but can't figure out what. Any help is appreciated!
Note: I cannot modify the dataset in any way. I can create new dataset if needed but prefer not to.
Unpivot your C1....C5 columns.
Then in your chart use your values as "values" and your created pivot column for axis.
Now you will see that the c1 c2 .... will be on the x axis.
You can show the counts by changing the calculation of you values to count.
Hope this helps
Related
Recently I came up with this problem:
I have a table with two different codes: COD1 and COD2. I want to create in power bi bar charts and tables with this information but I want to be able to change whether if I want to see them with COD1 or COD2. I have a slicer that gives you the option of which code you want the info be displayed. I've done this before with numeric data types because you can do this with a measure, however I don't know how to make it work with non-numeric columns.
COD1
COD2
Sales
AA
A10
5
AB
B45
10
CD
D44
20
I'm not exactly sure what you're trying to achieve but if I understand you correctly, you can change columns on a bar chart by making two bar charts. One will have COD1 as an axis with Sales, and the other will have COD2 as an axis with the same sales metric.
You could then use buttons and the bookmark functionality of Power BI to seamlessly "switch" the axis. See an example below:
I got a bar chart and I need to re-order the bars show in it. The bars show at which speed a person was driving and are currently sorted by the one that appears most often.
The data is imported in the structure:
The fields named *_id are used for filtering. What is shown in the bars is the count of the gemeten_snelheid column.
As shown in the bar chart the speeds are not sorted by "speed" but by count. Is it possible to re-order the bars so they are arranged by speed, and how would this be done?
I don't really know how to create a working example of this as the data is imported from a database connection, so if any more information is required feel free to ask.
You could create a new column and order by it, you could do it in sql, for example:
case when column1<30 then 1
when column1<40 then 2
when column1<50 then 3
column1_sort
Or you can do it in PowerBI, you could Add Column -> Conditional Column and write your Ifs. Or you can when in PowerBI desktop right click table, select New column and write something like:
Column_sort = if([Column1]="<30",1,if([Column1]="<40",2,if([Column1]="<50",3,4)))
Then select your not sorted column (Column1) and under Column tools there is Sort by column, and from there select column1_sort
Did you tried this below option? Here I am getting your expected output-
I currently have a column that lists a series of codes for the different business units we have, however, each entity can have more than one business unit affiliated with it (between 1 and 15 affiliations)
I then have a separate list of all the affiliation codes so I can make a simple bar chart showing metrics broken down by affiliation code, but I'm not sure how to make the relationship between the stand-alone list of codes and the entity data.
Any help would be appreciated - thanks
You need to normalise the table with the three columns. This can be done with Power Query.
Split the Affiliations into separate columns, then Unpivot all but the Entities column. After that, build your result from this new table.
I have several measures computed and I am placing them on the Line and Clustered column chart to display them side by side. The challenge I am having right now is i can not group them for displaying on the Chart. Please see the attached screenshot.
As you see all the measures are appearing one next to the other, total of 10. I want to separate them and show them as a group of two. Is this possible to do, may be by using other type of chart? I have to use the measures coz they contain computed values from the dataset imported.
If any one has an idea over this, please help. Thanks in advance.
Create a new table with one column containing all of the groups that you want. For example: Gross, Net, and Total and put that Group column on the clustered bar chart axis.
Create a measure for the first bar of each group and a measure for the second bar each group. For example:
Actual = SWITCH(SELECTEDVALUE(Groups[Group]),
"Net", [NetActual],
"Gross", [GrossActual],
"Total", [TotalActual])
Budget = SWITCH(SELECTEDVALUE(Groups[Group]),
"Net", [NetBudget],
"Gross", [GrossBudget],
"Total", [TotalBudget])
Now put the Actual and Budget measure on in the bar chart Value field and you should get something like this:
I am not sure if my title is correct one, but here is the deal:
I want to make a matrix visualization in Power Bi Desktop. I have fields: ARTICLE_ID and ARTICLE_NAME.
I would like to have both those fields in COLUMNS position in matrix data view. And I need them to be in one row, no need to drill down... because it is one and the same thing...
I need to have ARTICLE_ID and ARTICLE_NAME as two separate columns on the same level. without drilling. And also, I dont want to use concatenation or merging into some third column. is that possible? thanks
1) I started with this sample data.
2) I created a matrix and configured it as shown in the image below.
3) I clicked the forked arrows to show all levels.
4) In the Rows section of the formatting pane, I turned off "Stepped layout".
5) In the Subtotals section, I turned off "Row subtotals".
I don't know if this is exactly what you are looking for, but I think it is the closest I can come up with since you don't want to concatenate the columns together.
If they are from the same table then just drag and drop them into the columns.
The way a matrix works from my understanding in PowerBI is;
Rows are just the headings/categories of the values.
You might need to also go into the format tab, values, and make sure show on rows is on.
For example, let's say our value headings are rainy days and sunny days.
Your columns are months.
The rows will be the 2 categories.
The values will be the values.
As concatenation and "&" does not work in Power BI directquery you can use the below one:
[New_column_name] = if((table_name[column_name]="A" && table_name[column_name]="B"),"AB","NA")
Thanks,
Sachin Kashyap