Forum

Sort order on refer...
 
Notifications
Clear all

Sort order on referenced DIM table - can we avoid creating new table again?

8 Posts
2 Users
0 Reactions
92 Views
(@claudine)
Posts: 33
Trusted Member
Topic starter
 

Hi,

I referenced some queries to have a single dimension table, on which I would like to add a column with the sort order

Is there another way than creating it as a new table again?

Kr Claudine

 
Posted : 06/05/2020 4:14 am
(@mynda)
Posts: 4762
Member Admin
 

Hi Claudine,

I'm not sure what you mean, but if you right-click the query name in the Query editor you can choose to duplicate the query.

Mynda

 
Posted : 06/05/2020 5:32 am
(@claudine)
Posts: 33
Trusted Member
Topic starter
 

Hi Mynda

I have a facts table from where I derived a dim table for 1 column TEAMS, via Reference query, so additional values for teams would automatically come into my dim table. But I need an extra column to apply a sort order on teams

I only found a solution in manually creating a new table with 2 columns : my unique teams & the order
My initial DIM table does not make sense anymore in that case, it also means I have to manually maintain this table

Is there a way to directly create a sort order column in my referenced team query?

Kr Claudine

 
Posted : 06/05/2020 7:47 am
(@mynda)
Posts: 4762
Member Admin
 

It depends how you're determining the sort order. Is it something that can be done with 'add a custom column' or an index column?

 
Posted : 06/05/2020 9:11 am
(@claudine)
Posts: 33
Trusted Member
Topic starter
 

Till now, none of them, I just created a new table with a second column containing numeric values that defines the sort order of the first column (like I learned during the training)

Was looking if there was another way, eg via index or custom column

The sort order will have to be re-considered each time we have a new value in the list... might be required to put the new value somewhere in between the existing ones

 
Posted : 07/05/2020 8:47 am
(@mynda)
Posts: 4762
Member Admin
 

Hi Claudine,

I feel like I only have half of the information. If you're merging the tables, then there must be a common column other than the sort order column. So if you're adding this sort order column to a separate table and then merging, why can't you just add the sort order column to the original table and skip the merge?

I think you need to explain in more detail with screenshots or sharing the file so I can help you properly.

Mynda

 
Posted : 07/05/2020 7:03 pm
(@claudine)
Posts: 33
Trusted Member
Topic starter
 

Hi Mynda,

sorry for the inconvenience I cause, let me give me some more details and an e.g. file

1. I have a facts table from where I want to derive a DIM table for the columns TEAMS, I did this via Reference query (reason : would like to have an automated update of the unique values for the new values that come into my facts table)

2. I would like to see the values of the Teams in a specific order (for my visualizations)

the question is : is there a solution to add that sort order column directly to my referenced DIM table? I did not find how to

See attached simplified file 

Kr Claudine

 
Posted : 08/05/2020 3:53 am
(@mynda)
Posts: 4762
Member Admin
 

Hi Claudine,

Thanks for sharing the file. Unless there is some logic that can be applied to the Team names in order to derive the sort order, then no. Just as you couldn't write a formula to enter the sort order values, you couldn't add a custom column in Power Query. Since you can't type into the cells in the Power Query editor, this will be something you need to maintain manually, sorry.

Mynda

 
Posted : 08/05/2020 7:22 am
Share: