How to calculate

On a bar graph , in X-axis I need to get values for the same 2 months of different years as shown in the below image
Help me out in achieving this

@Praveen - You need to create a calculated field which can be utilized as the Sort key. Since you are looking to sort by the months and that to with financial year in view, please try to create a calculated field with the following expression.

ifelse(extract(‘MM’, {Order Date}) < 4, extract(‘MM’, {Order Date}) + 8, extract(‘MM’, {Order Date}) - 4)

Then try to utilize that field in Sorting like how shown below. Hope this helps!

Did my suggestion help you in resolving your query? If yes, would request you to mark the post as “Solution”. This will help the community to find guidance and answers to similar question. Thank you!

@sagmukhe ,

I did as per your suggestion did not get the desired output for the current financial year


Please try to retype the single quotes. They seem to have got morphed from the screenshot that you shared. If this doesn’t help, please let me know. Thanks!!

1 Like

You need to filter that visual for the corresponding years. That will result in having only the relevant year(s) that you need in the visual. As I can see now your visual is coming in right sort order. Please let me know. Thank you!

Thanks @sagmukhe,

But my scenario is when I open quicksight dashboard, by default it should show for current financial year, without entering year in filter

You can use the Relative Date Filter to do that! Please see the below snapshot for the settings. Hope this helps!

Thanks @sagmukhe

I got it for the selected years, but when I am entering other years in filters, it is not working

My scenario is when I open dashboard it should show current year, later when I give other years in control I need to get values of that particular year,

From your solution I am getting only for selected years in filters

In that case you can try to create parameter and assign a default value to it.

1 Like