Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
zb134
Helper I
Helper I

Show vertical bar chart without grouping items

I have data that spread across columns that I want to show in a vertical bar chart. The problem is the bar chart groups everything together because there really is no x-axis component to define.

 

Year 2021Year 2022Year 2023Year 2023Year 2025
2132126345234323242323423
213232343242332432433243242
31211532432432322343232432
35321134233232432324324343242

 

I want to show the sum of each year on a vertical bar graph with a target for each.

Problem is it get grouped together because I am unable to define a x-axis.

I know unpivot is a possible option but it doesn't work in my case because the actual data has lots of columns and is much more complicated than the sample table shown above.

 

What I end up now is something like this:

zb134_0-1672697828915.png

 

Any suggestion are higly appreciated!

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @zb134 ,

 

The easiest way to do this is to go to the Query Editor, select all columns, and then select Unpivot Columns.

However, you can also perform this operation in DAX, you can perform the following formula

1. Create calculated table.

Table 2 =
UNION(
SELECTCOLUMNS(
    'Table',
    "Year",2021,
    "Value",[Year 2021]),
SELECTCOLUMNS(
    'Table',
    "Year",2022,
    "Value",[Year 2022]),
SELECTCOLUMNS(
    'Table',
    "Year",2023,
    "Value",[Year 2023]),
SELECTCOLUMNS(
    'Table',
    "Year",2024,
    "Value",[Year 2024]),
SELECTCOLUMNS(
    'Table',
    "Year",2025,
    "Value",[Year 2025]))

vyangliumsft_0-1672713301125.png

2. Result:

vyangliumsft_1-1672713301131.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

5 REPLIES 5
v-yangliu-msft
Community Support
Community Support

Hi  @zb134 ,

 

The easiest way to do this is to go to the Query Editor, select all columns, and then select Unpivot Columns.

However, you can also perform this operation in DAX, you can perform the following formula

1. Create calculated table.

Table 2 =
UNION(
SELECTCOLUMNS(
    'Table',
    "Year",2021,
    "Value",[Year 2021]),
SELECTCOLUMNS(
    'Table',
    "Year",2022,
    "Value",[Year 2022]),
SELECTCOLUMNS(
    'Table',
    "Year",2023,
    "Value",[Year 2023]),
SELECTCOLUMNS(
    'Table',
    "Year",2024,
    "Value",[Year 2024]),
SELECTCOLUMNS(
    'Table',
    "Year",2025,
    "Value",[Year 2025]))

vyangliumsft_0-1672713301125.png

2. Result:

vyangliumsft_1-1672713301131.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

I had to do lots of transformations to get it right, but ultimately your directions helped a lot in getting it done!

Thanks for the reply, I know that unpivot can work with sample data given but the real data I am dealing with is not a straightforward colum but rather a Calculated field

 

2023 Calc =
CALCULATE(
[2023],
'Inventory'[Direct vs Indirect] IN { "Direct" },
'Inventory'[Benefit Type] IN { "Costs" },
LASTDATE('Calendar'[Date])
)

 

When I plot it right now using the clustered vertical I get this for year 1 and year 2. The numbers are correct, it's just that they are grouped together that's the issue

zb134_0-1672724454895.png

When I use your suggestion :

Table 2 =
UNION(
SELECTCOLUMNS(
'Inventory',
"Year",2023,
"Value",[2023 Calc]),
SELECTCOLUMNS(
'Inventory',
"Year",2024,
"Value",[Year 2024])
))

 

I end up getting 

zb134_1-1672724977334.png

Not sure where those numbers are coming from, is it just not respecting the filters in the calculated measure?

Nathaniel_C
Community Champion
Community Champion

Hi @zb134 ,
If I understand your question, you are looking for something like this?

Nathaniel_C_0-1672706365029.png

 

Create a measure for SUM () of each year.

YR 2021 = SUM(TableT[Year 2021])

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for the reply but I need it not to be grouped together as shown but seperated under x-axis categories for each year.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors