Groupings comparing YTD valus

HI

I have this measure for which i want to compare YoY growth by Sales Banding. It works following the recommended pattern (I believe) however I’d like previous years to be showing the sameperiod as 2021 in this case Jan to Sept. How can I amend this to get the desired effect?

Sales per Banding = 
CALCULATE(
    [Sales YTD],
       FILTER(
           VALUES( Customers[Customer] ),
               COUNTROWS(
                   FILTER(
                       'Sales Banding',
                       [Avg Sales] >= 'Sales Banding'[Min] &&
                       [Avg Sales] < 'Sales Banding'[Max]
                   )
               ) > 0
       )
)

image

Hello @AliB,

Thank You for posting your query onto the Forum.

Well, if you want to analyze the “Current Year’s Banding”, “Previous Year’s Banding” and then “YoY% Sales Growth per Banding”. Below are the measures provided for the reference. Since you’ve already created the measure for Current Year’s Banding the below are the measures for Previous Year’s Banding -

Sales per Banding - Previous Year = 
CALCULATE( [Sales per Banding] , 
      DATEADD( Dates[Date] , -1 , YEAR) )



YoY% Sales Growth per Banding =
DIVIDE(
   [Sales per Banding] - [Sales per Banding - Previous Year] , 
   [Sales per Banding - Previous Year] , 
   0 )

But if you want to analyze the “Current Year’s Banding” and then directly “YoY% Sales Growth per Banding” without writing a measure for “Sales per Banding - Previous Year” as a mediator. You can write the measure as follows -

YoY% Sales Growth per Banding = 
VAR _Current_Year = 
CALCULATE(
    [Sales YTD],
       FILTER(
           VALUES( Customers[Customer] ),
               COUNTROWS(
                   FILTER(
                       'Sales Banding',
                       [Avg Sales] >= 'Sales Banding'[Min] &&
                       [Avg Sales] < 'Sales Banding'[Max] ) ) > 0 ) )


VAR _Previous_Year = 
CALCULATE(
   CALCULATE(
      [Sales YTD],
         FILTER(
             VALUES( Customers[Customer] ),
                 COUNTROWS(
                     FILTER(
                         'Sales Banding',
                          [Avg Sales] >= 'Sales Banding'[Min] &&
                          [Avg Sales] < 'Sales Banding'[Max] ) ) > 0 ) ) ,
   DATEADD( Dates[Date] , -1 , YEAR) )

VAR _YoY_Percentage_Sales_Growth = 
DIVIDE(
   _Current_Year - _Previous_Year , 
   _Previous_Year , 
   0 )

RETURN
_YoY_Percentage_Sales_Growth

I’m also attaching the working of my example of PBIX file for the reference purposes since you didn’t attached any.

Hoping you find this useful and meets your requirements that you’ve been looking for. :slightly_smiling_face:

Thanks and Warm Regards,
Harsh

Grouping and Segmenting - Harsh.pbix (618.0 KB)

Thanks Harsh - exactly what I wanted - I was clearly over thinking it! :woman_shrugging:

The 2nd option is great and has helped further my understanding.

THanks again

Hello @AliB,

You’re Welcome. :slightly_smiling_face:

I’m so glad that I was able to assist you in your query and you found it helpful.

Thanks and Warm Regards,
Harsh