Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

LY YTD Calculation

Hi,

 

I need assistance with creating a DAX formula for LY YTD values.

FYI - I have a period slicer in my model (2 slicers, YEAR and QUARTER).

 

The problem is, the values in my model have an ABFlag that filters actual & budget values.

I want to calculate LY YTD, but because there are "budget" values that go throughout the whole year, when 2020 is selected; LY YTD calculates the entire last year, even with SAMEPERIODLASTYEAR being used.

 

How do I incoporate this into my DAX so that the SAMEPERIODLASTYEAR only counts the period for which there are "actual" sales?

 

Revenue includes both A & B, so I have created a measure.

 

RevA = CALCULATE([Revenue],'TABLE'[ABFlag]="A")

 

This is the function that is returning the entire last year, but I need it to only pickup where there are actual sales.

 

RevA YTD LY = CALCULATE([RevA],SAMEPERIODLASTYEAR('Calendar'[Date]))
 
Cheers,
Dan

 

6 Replies