Skip to main content

Hi, i try to create a comparison for CY vs PY of the average of sales in a side by side bar chart.

where the period is handled by parameters.

 

i have made 4 calculations for this :

1.to count the average sales

How to create side by side CY and PY bar chart of aggregated measures?2.to get the current year's value

image3..to get the previous year's value

image4.to get the latest year that was existed in the data source

image 

i want that my chart only shows the current period (from Jan to selected month parameter) with the previous year's bar beside the current year's bar for the same month.

 

i have succeeded creating that chart if the measures is the sales, as shown below :

image 

 

however, the PY data for the average sales are returned as NULL, as shown below :

image 

any idea how to solve this issue?

 

really appreciate your help.

thanks

 

Ary

1 answer
  1. Nov 30, 2022, 10:44 AM

    @Aryono Samarto​ 

    Hi, attached you will find an example workbook.

    @Aryono Samarto​ Hi, attached you will find an example workbook.Hint, for the bar in bar I switched off the stack marks:If this post resolves the question, would you be so kind toHint, for the bar in bar I switched off the stack marks:

    imageIf this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000