简体   繁体   中英

Making a stacked bar using different columns in PowerBI

Hi I'm Trying to take data in PowerBI that looks like this

数据表

It basically has several columns with reason for call and the length of time in each one - the time varies

Reason1 Reason2 Reason3
--       30 secs   30 secs
60 secs   1 min    ----
---       2 min    ----

I need a graph that shows each of these reason split by the length of calls

首选视觉

thank you (I am also an amateur at PBI so be gentle)

You need to flatten your table into a two column layout. Edit the data source in the Query editor. Starting out, it may look like this: 在此处输入图片说明

Select all columns and click the Unpivot Columns command in the Transform ribbon. Now your data looks like this:

在此处输入图片说明

Rename "Attribute" to "Category" and rename "Value" to "Time Frame". Filter the Time Frame column and untick Blanks.

在此处输入图片说明

Close and apply the query.

Now you can build a stacked horizontal bar chart. Put "Category" on the Axis and drag "Time Frame" into the values. Since it is text, it will be aggregated with a Count. Drag "Time Frame" into the legend to give each time frame its own colour. Viola!

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM