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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
gdaniel
Frequent Visitor

Show 6 months of data, total the rest

Hello, 

I need to create a Matrix report that show 6 months of data, then totals everything beyond 6 months.  

I have sucessfully created a calculated column that does this.  

 

_MonthYear =
IF('Calendar'[Date] >= EOMONTH(TODAY(), 6), "Beyond 6 Months"  'Calendar'[MonthYear])
 
It works, but displays the months in alphabetical order, not chronological.  
 
gdaniel_0-1741807404328.png

 

I need to figure out either 1) how to sort the _MonthYear column chronologically, or 2) how to hide columns greater than 6 months out but still keep the Total column.  

 

The error I get when trying to sort the _MonthYear column is this:

 

gdaniel_1-1741807578494.png

Appreciate any help!

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

To sort chronologically, you need to create a new integer column. This could be something like:

Month Sort Column = SWITCH('Calendar'[MonthYear], "Beyond 6 Months", 9999999, FORMAT('Calendar'[MonthYear], "yyyymm") // e.g. Apr-2025 should give you 202504

vicky__0-1741814805480.png

then select your original Month-Year column and sort using the above.

 

Otherwise, you could try something like:

Table Measure = IF(HASONEVALUE(Calendar[MonthYear]), [Your normal calculation], [Your calculation for the total])

View solution in original post

4 REPLIES 4
techies
Super User
Super User

Hi @gdaniel please try this

 

 

In Power Query, add an Index Column to your Calendar table and name it _MonthYearIndex.
In Data View, select _MonthYear and sort it by _MonthYearIndex.

 

Power BI & Microsoft Fabric
PL-300 | DP-600 | DP-700 Certified
vicky_
Super User
Super User

To sort chronologically, you need to create a new integer column. This could be something like:

Month Sort Column = SWITCH('Calendar'[MonthYear], "Beyond 6 Months", 9999999, FORMAT('Calendar'[MonthYear], "yyyymm") // e.g. Apr-2025 should give you 202504

vicky__0-1741814805480.png

then select your original Month-Year column and sort using the above.

 

Otherwise, you could try something like:

Table Measure = IF(HASONEVALUE(Calendar[MonthYear]), [Your normal calculation], [Your calculation for the total])

Thanks @vicky_ ,  I created a column like this, and it works to create the correct data in the column:  

 

_Sort2 = IF(
    'Calendar'[Date] >= EOMONTH(TODAY(), 6), "999999",
        FORMAT( 'Calendar'[Date], "YYYYMM"))
 
gdaniel_0-1741878878474.png

However, when I try to sort my _MonthYear column with this new _Sort2 column, I get a very unhelpful error message  😞 

gdaniel_1-1741878952351.png

I will keep working on this, and post a solution if I find one.

Update - the sort column solution above worked!  I researched the validation error message I received, and was able to resolve it by doing this:  

Verify whether a program is causing the issue by closing Power BI Desktop, opening Windows Settings > About > Advanced system settings and selecting Environment Variables. Select New under User variables and add variable name WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS with the value --disable-features=RendererCodeIntegrity.

Thanks again @vicky_ 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.