Forum Discussion

amaaiia's avatar
amaaiia
Skilled Sharer
1 year ago

Sort one column by another column in another table

Hi.

I have one fact table and one dimension table in the semantic model, related by City field:

 

Fact:

CityYearValue
Madrid20223
Madrid20235
Madrid20246
Barcelona20228
Barcelona20234
Barcelona20241

 

Dimension:

CityOrder
Madrid1
Barcelona2

 

In the report, I have a Pivot Table as follows:

 BarcelonaMadrid
202238
202354
202461

 

I want to order pivoted City column with Dimension[Order] columns, so in that case Madrid is 1 and Barcelona is 2 (more Cities can be added). So the pivoted table would be as follows:

 MadridBarcelona
202283
202345
202416

The semantic model is in DirectLake mode. I know one approach is to add Order column in fact table, but this is not a good idea because this order might change, that's why I prefer having a dimension table.

 

Any ideas?

3 Replies