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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
AjithReddy049
Frequent Visitor

matrix Column headers Order Handling

Hi Team,

 

I have some requirements like.

 

in a matrix visual would like to show the latest 3 months' column headers like Sep-2023, Oct-2030, and Nov-2023 in the current year,
and the remaining current year months column header "Remaining Months - 2023".

In previous years yeas data Headers like FY-22, FY-21, FY-20

Product NameFY-20FY-21FY-22Remaining Months - 2023Sep-23Oct-30Nov-23
Bikes       
Accessories       
Clothing       




AjithReddy049_0-1672990053804.png

 



Prix Linkhttps://1drv.ms/u/s!Aut620beS3BbgQhFFC6UAPK1wWUy?e=qU9hXq

 

kindly suggest this.


Thanks
Ajith





1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AjithReddy049 ,

I created your sample pbix file(see the attachment), please check if that is what you want. Please create a calculated column as below and put it on the Columns Field of matrix just like below screenshot...

Column = 
VAR _maxdate =
    CALCULATE ( MAX ( 'Query1'[DueDate] ), ALL ( 'Query1' ) )
VAR _mindate =
    EOMONTH ( _maxdate, -3 ) + 1
VAR _mindyear =
    YEAR ( _mindate )
VAR _dyear =
    YEAR ( Query1[DueDate] )
RETURN
    IF (
        'Query1'[DueDate] >= _mindate
            && 'Query1'[DueDate] <= _maxdate,
        'Query1'[Format],
        IF (
            _dyear = _mindyear,
            "Remaining Months - " & _mindyear,
            "FY-" & RIGHT ( _dyear, 2 )
        )
    )

yingyinr_0-1673255645527.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @AjithReddy049 ,

I created your sample pbix file(see the attachment), please check if that is what you want. Please create a calculated column as below and put it on the Columns Field of matrix just like below screenshot...

Column = 
VAR _maxdate =
    CALCULATE ( MAX ( 'Query1'[DueDate] ), ALL ( 'Query1' ) )
VAR _mindate =
    EOMONTH ( _maxdate, -3 ) + 1
VAR _mindyear =
    YEAR ( _mindate )
VAR _dyear =
    YEAR ( Query1[DueDate] )
RETURN
    IF (
        'Query1'[DueDate] >= _mindate
            && 'Query1'[DueDate] <= _maxdate,
        'Query1'[Format],
        IF (
            _dyear = _mindyear,
            "Remaining Months - " & _mindyear,
            "FY-" & RIGHT ( _dyear, 2 )
        )
    )

yingyinr_0-1673255645527.png

Best Regards

AjithReddy049
Frequent Visitor

@amitchandak 


thanks for the response.

Could you please elaborate above measure, [FY] is it a measure? if measure what I need to aggregate?

amitchandak
Super User
Super User

@AjithReddy049 , You have create a new column in date table with these header and also the sort column

 

Example

COlumn = Switch(True(),

[FY] < "FY-23", [FY],

Month([Date]) < 10, "Remaining month of 23",

Format([Date], "mmm-yyyy"))

 

Same way create an order column too

 

How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.