Forum Discussion
Show vertical bar chart without grouping items
- Anonymous3 years ago
Hi Anonymous ,
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]))2. Result:
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
Hi Anonymous ,
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]))
2. Result:
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
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
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
Not sure where those numbers are coming from, is it just not respecting the filters in the calculated measure?