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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
amaaiia
Super User
Super User

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 3
audreygerred
Super User
Super User

Hello! You can achieve this by joining your dimension table to your fact. Then, in the dimension table, click on city field, go to the Column Tools ribbon, go to Sort by Column and select Order field. Next, in your matrix visual, add in what you want to rows (year) and put city from your dim table in columns and your measure in values.

 

Viola!

audreygerred_0-1727796575077.png

 





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

Proud to be a Super User!





I cant' join tables in DirectLake mode, it should me Import Mode.

As far as I know, you can create realtionships with tables in direct lake mode in power bi - see this article, the relationships are there are the tables are direct lake. Leveraging pure Direct Lake mode for maximum query performance | Microsoft Power BI Blog | Microsoft... And, since star schema is still recommended in direct lake, relationships/joins are needed: Define relationships in data models for data warehousing - Microsoft Fabric | Microsoft Learn

Define relationships in data models for data warehousing - Microsoft Fabric | Microsoft Learn





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

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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