Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hello,
I need a graph on my dashboard to have a variable column based on the selection made in a filter.
I managed to achieve this through a method I found on the internet where I create an intermediate table and connect the filter table with the dimension that has the columns I need in the graph:
I created a formula where I list the column I need based on the selection made in the filter:
Semana Selecionada =
SWITCH('Semanas x Datas'[Semanas],
"Termina Segunda", RELATED(Dim_Calendario[Termina Segunda]),
"Termina Terça", RELATED(Dim_Calendario[Termina Terça]),
"Termina Quarta", RELATED(Dim_Calendario[Termina Quarta]),
"Termina Quinta", RELATED(Dim_Calendario[Termina Quinta]),
"Termina Sexta", RELATED(Dim_Calendario[Termina Sexta])
)
The method worked and the column that appears in my graph is exactly the column that I selected in the filter, however the data order was completely random, I had configured the order that the columns should have in the data part of the power bi, but this function it is disregarding the order that I had configured for the columns.
How do I make this function maintain the order that I determined for the columns?
Solved! Go to Solution.
@Anonymous , If it is a column. Create one more column, in the same manner, having sort order of these columns and mark that as a sort column
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
Does anyone know if there is any way to maintain the order of the columns in this type of graph?
@Anonymous , If it is a column. Create one more column, in the same manner, having sort order of these columns and mark that as a sort column
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
I didn't understand what you said, but now I understood and it worked perfectly, thank you very much
This method is not working in this case, each column of the switch has a specific column to determine its order, here's an example:
The column highlighted in red "Termina Quinta" is ordered by the column highlighted in green "IQuinta", the column highlighted in purple "Termina Segunda" is highlighted by the column highlighted in blue "ISegunda", the same goes for the other columns.
The column that is used in my graph depends on the selection I make in the filter, for example, if I select "Termina Segunda" in the filter the graph will use the column Dim_Calendario [Termina Segunda] in the graph, following image to illustrate:
The column used in the graph is generated by the formula:
Semana Selecionada =
SWITCH('Semanas x Datas'[Semanas],
"Termina Segunda", RELATED(Dim_Calendario[Termina Segunda]),
"Termina Terça", RELATED(Dim_Calendario[Termina Terça]),
"Termina Quarta", RELATED(Dim_Calendario[Termina Quarta]),
"Termina Quinta", RELATED(Dim_Calendario[Termina Quinta]),
"Termina Sexta", RELATED(Dim_Calendario[Termina Sexta])
)
When I select the column in the filter the graph shows the respective column but in a totally random order, it does not respect the order that I determined for the columns in the table "Dim_Calendario".
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 61 | |
| 47 | |
| 39 | |
| 24 | |
| 23 |
| User | Count |
|---|---|
| 144 | |
| 106 | |
| 63 | |
| 38 | |
| 31 |