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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Sampathkumar_v
Helper II
Helper II

How to sort based on my current FY year in power bi

Hi Folks,

My report having two years of data now, created tabluar view while doing sory by sales it's considering both year sales but my requirement is it should sort by only latest year but in excel it's simple while in power bi i am not able to find the option to sory by latest year. 

e.g my product column should sort by 2023 it shouldn't sort by including 2022 and 2023. 

Sampathkumar_v_0-1681287640390.png

 

1 ACCEPTED SOLUTION

Hi Thanks for your support to make this happen. It's working as excepted now.

View solution in original post

10 REPLIES 10
v-jianboli-msft
Community Support
Community Support

Hi @Sampathkumar_v ,

 

Please try:

 

Sum of Value 1 = 
VAR _a =
    MAXX ( ALLSELECTED ( 'Base RCR ADT'[QTR] ), VALUE(RIGHT([QTR],2)))
VAR _b =
    SUMX (
        FILTER (
            ALL ( 'Base RCR ADT' ),
            'Base RCR ADT'[Grp Customer Name] = SELECTEDVALUE ( 'Base RCR ADT'[Grp Customer Name] )
                && VALUE(RIGHT([QTR],2))=_a
        ),
        [revenue in MN]
    )
RETURN
    IF ( ISINSCOPE ( 'Base RCR ADT'[QTR] ), ( [revenue in MN] ), _b ) 

 

Final output:

vjianbolimsft_0-1682037482933.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Thanks for your support to make this happen. It's working as excepted now.

v-jianboli-msft
Community Support
Community Support

Hi @Sampathkumar_v ,

 

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

If this is your original data:

vjianbolimsft_0-1681787755285.png

Is this the result you need:

vjianbolimsft_1-1681787833414.png

 

Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi 

 

Product column should sort by year of 2024. In power bi sort order works based on year column. How can we achive this in power bi? Excepted output from Power bi is below:

Sampathkumar_v_0-1681910334823.png

Actual sort order works in power bi is below:  Product column sort order happens based on year (2022,2023 & 2024)

Sampathkumar_v_1-1681910463324.png

 

 

 

 

Hi @Sampathkumar_v ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1681955925369.png

Please try:

Sum of Value =
VAR _a =
    MAXX ( ALLSELECTED ( 'Table'[Year] ), [Year] )
VAR _b =
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Product] = SELECTEDVALUE ( 'Table'[Product] )
                && [Year] = _a
        ),
        [Value]
    )
RETURN
    IF ( ISINSCOPE ( 'Table'[Year] ), SUM ( 'Table'[Value] ), _b )

vjianbolimsft_1-1681956007750.png

Then sort by Sum of Value:

vjianbolimsft_2-1681956038178.png

Final output:

vjianbolimsft_3-1681956052365.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Sir,

Thanks for your guidence when i was tried with same logic into my file not given as excepted. now I have attached the screen shot the way i am looking in to my file (I am not able to attach the PBIX file to make you to understand better) Company FY year start from April to March so accordingly we have breaked the Quarter. 

e.g period name has a direct column from that drived QTR column in 2nd visual QTR we kept in column shelves customer name in Row shevles in values column one of the measure. in 2nd chart how can we sort by only latest Quarter Q1'23,Q2'23,Q3'23 & Q4'23 still i need in my visual  Q1'22,Q2'22,Q3'22 & Q4'22.

Sampathkumar_v_0-1681973449803.png

 

Tried below logic: but still no work around. kindly help me on this. 

Sum of Value 1 =
VAR _a =
    MAXX ( ALLSELECTED ( 'Base RCR ADT'[period name] ), [period name] )
VAR _b =
    SUMX (
        FILTER (
            ALL ( 'Base RCR ADT' ),
            'Base RCR ADT'[Grp Customer Name] = SELECTEDVALUE ( 'Base RCR ADT'[Grp Customer Name] )
                && [period name] = _a
        ),
        [revenue in MN]
    )
RETURN
    IF ( ISINSCOPE ( 'Base RCR ADT'[period name] ), ( [revenue in MN] ), _b ) 

Hi @Sampathkumar_v ,

 

Based on your description, I have modified my sample:

vjianbolimsft_0-1681978199346.png

Please try:

Sum of Value 1 = 
VAR _a =
    MAXX ( ALLSELECTED ( 'Base RCR ADT'[QTR] ), VALUE(RIGHT([QTR],2))*10+VALUE(MID([QTR],2,1)))
VAR _b =
    SUMX (
        FILTER (
            ALL ( 'Base RCR ADT' ),
            'Base RCR ADT'[Grp Customer Name] = SELECTEDVALUE ( 'Base RCR ADT'[Grp Customer Name] )
                && VALUE(RIGHT([QTR],2))*10+VALUE(MID([QTR],2,1))=_a
        ),
        [revenue in MN]
    )
RETURN
    IF ( ISINSCOPE ( 'Base RCR ADT'[QTR] ), ( [revenue in MN] ), _b ) 

Sort the visual as mentioned before

Final output:

vjianbolimsft_1-1681978247445.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi sir,

 

Thanks for your help make this to resolve 90% bit more concern how can we sort by entire QTR of 2022? for now the solution has provided based on latest QTR of year mean Q4'22.

I mean customer name sort by entire QTR of 2022 (Q1'22,Q2'22,Q3'22 & Q4'22) grand total of all QTR. 

v-jianboli-msft
Community Support
Community Support

Hi @Sampathkumar_v ,

 

When you're editing a report in Power BI, you can choose a column to define the sort order of another column.

To set a different column to sort by in Power BI Desktop, both columns need to be at the same level of granularity. For example, to sort a column of month names correctly, you need a column that contains a number for each month. The sort order will apply to any visual in the report that contains the sorted column.

 

Here is an article shows how to set the sort order of one column by a different column, in Power BI Desktop or in the Power BI service:

Sort one column by another column in Power BI - Power BI | Microsoft Learn

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

No this is not my scenario my requirement is that still my tabular view should reflect two years of data in column shelves irrespective of any row shelves if we do sort by normally it will consider two years of value but my ask is that can do do sory by selected year or latest year (e.g 2011 and 2012) only sort order applies 2012 it shouldn't include 2011 while sorting)  

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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