Facing issue with formate date function in visualization

I am creating Month column using the formula formatDate({TransactionsDate} ,‘MMMM’) in the dataset
and also created Month_Updated with the same formula but i cannot use this field in my pivot table its giving me error

when i use the field which is created in dataset i am able to see in pivot table

Hi @Sangeetha

Welcome to the QuickSight community!

Instead of using formatDate, use the following approach to ensure the month field works properly in pivot tables.

Example:

switch(
    extract('MM', OrderDate),
    1, 'January',
    2, 'February',
    3, 'March',
    4, 'April',
    5, 'May',
    6, 'June',
    7, 'July',
    8, 'August',
    9, 'September',
    10, 'October',
    11, 'November',
    12, 'December',
    'Unknown'
)

Thank You @Xclipse
but here i can’t sort Month Wise right

Hi @Sangeetha

To ensure correct month-wise sorting in the pivot table, extract the month number from the data and add it to the pivot table. Sort it in ascending order based on the month number, then hide the column. This way, the month names appear in the correct order while keeping the table clean.

Example:

extract('MM', OrderDate)

1 Like

Thank You so much @Xclipse