The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I can't sort year week column in Power BI. I am getting this:
the order is wrong -2 should be before 19 not after. So how to fix it?
Solved! Go to Solution.
Hi @Analitika ,
May I know the field in your screenshot is a fact field or a calculated column? If it is a calculated column, could you please provide the related formula? Otherwise, you can create new calculated column as below and sort the new calculated column.
Column 2 =
VAR _position =
IFERROR ( SEARCH ( "-", 'Table'[Column], 1, 0 ), 0 )
VAR _week =
MID ( 'Table'[Column], _position + 1, LEN ( 'Table'[Column] ) - _position )
RETURN
IF (
VALUE ( _week ) < 10,
LEFT ( 'Table'[Column], 4 ) & "-0" & _week,
'Table'[Column]
)
In addition, you can refer the following links to get it.
Sort a Column with a Custom Order in Power BI
1. Create a sort dimension table![]()
2. Create a relationship between sort dimension table and fact table
![]()
3. Sort by column EnglishEducation (groups)
Custom sort orders in Power BI
Best Regards
Hi @Analitika ,
May I know the field in your screenshot is a fact field or a calculated column? If it is a calculated column, could you please provide the related formula? Otherwise, you can create new calculated column as below and sort the new calculated column.
Column 2 =
VAR _position =
IFERROR ( SEARCH ( "-", 'Table'[Column], 1, 0 ), 0 )
VAR _week =
MID ( 'Table'[Column], _position + 1, LEN ( 'Table'[Column] ) - _position )
RETURN
IF (
VALUE ( _week ) < 10,
LEFT ( 'Table'[Column], 4 ) & "-0" & _week,
'Table'[Column]
)
In addition, you can refer the following links to get it.
Sort a Column with a Custom Order in Power BI
1. Create a sort dimension table![]()
2. Create a relationship between sort dimension table and fact table
![]()
3. Sort by column EnglishEducation (groups)
Custom sort orders in Power BI
Best Regards
User | Count |
---|---|
5 | |
5 | |
2 | |
2 | |
2 |
User | Count |
---|---|
10 | |
7 | |
4 | |
4 | |
4 |