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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors