cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
domtrump
Frequent Visitor

Sorting dates in pivot table

Sure this has been asked, but the "suggestions" I'm finding I either don't understand or do not apply to my particular situation. My data assigns all transactions that occur in a month to the last day of the month (i.e. 1.21.23, 1.25.23, 1.27.23 would all be "stamped" as 1.31.23). The business requirement is for alll the date headers both across and down in the pivot table be in the format "mmm yyyy" (Jan 2023). So I create my date dimension with all dates and the Month category in the appropriate format:

 

Date            FMT_Date

1/25/2022Jan 2022
1/26/2022Jan 2022
1/27/2022Jan 2022
1/28/2022Jan 2022
1/29/2022Jan 2022
1/30/2022Jan 2022
1/31/2022Jan 2022
2/1/2022Feb 2022
2/2/2022Feb 2022
2/3/2022Feb 2022
2/4/2022Feb 2022
2/5/2022Feb 2022
2/6/2022Feb 2022
2/7/2022Feb 2022
2/8/2022Feb 2022
2/9/2022Feb 2022
2/10/2022Feb 2022
 
1/24/2023Jan 2023
1/25/2023Jan 2023
1/26/2023Jan 2023
1/27/2023Jan 2023
1/28/2023Jan 2023
1/29/2023Jan 2023
1/30/2023Jan 2023
1/31/2023Jan 2023
2/1/2023Feb 2023
2/2/2023Feb 2023
2/3/2023Feb 2023

 

And of course the following apply:

  • I imagine if this was one of the "available" date formats in the PP grid, this whole thing would be a non issue - but it isn't. And unlike in regular Excel, you cannot put a custome format mask on the date
  • Of course when I place the FMT_Date as columns or rows on the pivot table, it is in alphabetical order AND all the Apr's are together for each year, Aug's , etc.
  • And I understand why my date dimension table cannot sort FMT_Date on Date 

domtrump_0-1682528107534.png

 

So what is the simplist (pronounced - with the least amount of programming) to achieve the desired result?

 

domtrump_1-1682528273432.png

 

1 ACCEPTED SOLUTION
Wilson_
Solution Specialist
Solution Specialist

Hello,

 

You can add another column to your date table in the format YYYYMM to sort your MMM YYYY table on (the below should work). That would solve the error message you're getting and allow you to sort.

FORMAT ( 'Dates'[Date], "YYYYMM" )

----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

View solution in original post

1 REPLY 1
Wilson_
Solution Specialist
Solution Specialist

Hello,

 

You can add another column to your date table in the format YYYYMM to sort your MMM YYYY table on (the below should work). That would solve the error message you're getting and allow you to sort.

FORMAT ( 'Dates'[Date], "YYYYMM" )

----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors