I am using a stacked bar chart for presenting the gender ratio in various region.
here the legend is gender and Axis is region and value is headcount.
when i want to sort the chart according to female gender value . the sorting is only done by the headcount value. how can i sort it for the percentage value. please help me.
EDIT: My first answer focused only on count, now I've taken into account that OP wants to sort by percentage female value
You can sort your data directly in your Stacked column chart visualization, after pivoting the data and adding a column showing the female percentage value using the Power Query Editor. If you insert the female ratio as a Tooltip, your chart can be sorted as that value even though it is not displayed in your chart.
Here are the details:
This data sample should fit your description:
Region,Gender,Count
USA,M,9000
USA,F,7000
EU,M,5000
EU,F,5000
UK,M,2000
UK,F,4000
CAN,M,100
CAN,F,900
If you enter that data using Edit Queries / the Power Query Editor, you can set it up like this:
Now highlight the Gender column, and select Transform > Pivot Column to get this:
Under Values Column, select Count and click OK to get this:
Now simpy add a custom column to calgulate the female ratio like so:
Now your table should look like this:
In the desktop, insert a stacked column chart and set it up like below. Notice that you'll need to insert F ratio under Tooltips:
Now you can sort your chart by Ascending or Descending F ratio
Related
I have this matrix created:
and I have a bar chart like this:
in my table I have a column called: account_website, account_whatsapp, account_self_service,account_mobile,account_chatbot
what i want is whenever someone clicks on the matrix, based on the row, displays the corresponding column.
ex: if someone pressed on whatsapp it will visualize the count of the account_whatsapp for the x axis and the names of the values on the y axis
I am fairly new to power bi, how can I do this ?
I have created a Dashboard where I have a list of 100 entries of different frim names, I have created a rank measure and have add it to the filters to get the top 25 firms in terms of their sales and I have a bar & line chart at the bottom.
My problem is that my table data with the firm names & their other details is getting filtered but my Bar & line chart shows the data for the entire 100 entries its not getting filtered as per my top 25 firms.
I tried using the rank measure in its filters but still not working, but if we select an induvial firm or multiple firms it changes.
Can some please help me here, I want my charts to auto filter the moment I select top 25 button along with my table
If you have a Rank measure created, you can use Filter Type "Top N" by Rank value.
To test the same:
Select the visual created.
on the Filters pane on the right, expand the firm filter.
Under filter type, select the option "Top N" and value as Rank.
Apply filter
Hi I'm trying to order a table in BI by monthNumber, but now I have same months in differents year, and PowerBI doesn't care about that. I have:
Jan-20
Feb-19
Feb-20
Mar-19
Mar-20
Apr-19
May-19
Jun-19
Jul-19
Aug-19
Sep-19
Oct-19
Nov-19
Dec-19
And I want:
Feb-19
Mar-19
Apr-19
May-19
Jun-19
Jul-19
Aug-19
Sep-19
Oct-19
Nov-19
Dec-19
Jan-20
Feb-20
Mar-20
NOTE: Each month I will add a new month (The actual current month e.g. Now Aug-20) and this should still work properly
Let your table name is "order_by_month" and the column name is "month_year". Now just follow this following steps to order data as per your requirement.
Step-1: In Power Query, create a custom column as below image-
We are generating this column with the First date of each month so that we can order our original data later based on the Date value. The generated value in the new column will look like below-
Step-2: Change the above red marked column's data type as Date.
Step-3: Get back to report by clicking the "Close & Apply" Button.
Step-4: In the report, go to Table view and select your original column "month_year" and order this column by newly created column "date_formatted_value" as shown in the beloe image.
Now the final output will be sorted as below as you wants-
I have a table visual with a date column and I have a requirement to highlight the top 2 rows. The data on the table visual is sorted desc by the date column.
I need help to conditional format the background color for the top 2 rows.
I tried searching for a way to do this but no luck.
You can calculate the rank of the rows and use conditional formatting to highlight the top 2 rows. But first, we need to define what "top 2 rows" means. You said it is sorted by date descending, so I will assume that "top 2 rows" means the rows with the 2 biggest dates. I will use a measure, which will respond to filters applied on the data. Then we will highlight the rows with rank 1 and 2 (assuming dates are unique in table's rows).
Make new measure like this:
Measure = RANKX(ALLSELECTED('Table'); CALCULATE(SELECTEDVALUE('Table'[Date])))
Where Table is your table name, and Date is the name of the date column. This will give you a number (1, 2, 3...) where 1 is the row with the biggest date, 2 is the second biggest date, and so on.
Then for every field shown in your table, add the following background color condition (right click each item in the list of fields and select Conditional formatting -> Background color):
Set Format by to be Rules, select your measure in Based on field and ad condition > 0 and <= 2 to set the desired background color. Repeat this for all fields shown.
Please consider this scenario:
I have a table in Power-BI that's like this:
Country Total Sales
-----------------------------
USA 2000
Canada 1400
Spain 3200
And I want to have a Pie chart in page that if user clicks on every rows, The pie shows sales type for that Country. For Example:
How can I connect these to visuals together?
Thanks
If the two visuals shows data from the same data source, then they will be "connected" by default, i.e. when the user clicks on a row in the table, the pie chart will show only the data from the selected country, and if the user clicks on a sector from the chart, the table will show only the amounts for this category.
If you have a table in your data source like this:
Then add a table in the report with columns Country and Sales like this:
By default amounts will be aggregated as sum, so the table will show sum of Sales per Country. You can change the default summarization of the currently selected field in Modeling tab:
Add a pie chart with Category field in the legend and Sales field for value. Change the value to be shown as percentage from the grand total like this:
Adding Sales field as tooltip will also show the amount when pointing to a sector:
Now when you click on a row in the table, the pie chart will show only the relevant data:
For more information take a look at Change how visuals interact in a Power BI report and Filters and highlighting in Power BI reports articles.
Well, it does not work if the pie chart is top-N pie chart. I open a new issue to the Power BI community to fix it. Here is a description of the issue: Basically, I have a top-N pie chart created for states. But, when I select a city in a table and the city is not in one of those states, the pie chart is not updated to show the state of the selected city. Instead, it remains to show those top-N states with 0% in every slices. This is wrong. It should show the top-N states of the "selected" cities.