Forum Discussion
Jameswh91
Helper III
4 years agoLast Year Sales calculation with custom dates
Hi, I'm looking to create a dax calculation that has last years financial ytd sales. I'm ideally looking for a formula that uses the start of the year as 1st May. Many thanks in advance for any h...
- Anonymous4 years ago
Hi Jameswh91 ,
First create an independent yearmonth table as slicer.
calendar = distinct('Table'[yearmonth])Then create a measure like below:
custom_LYTD = CALCULATE ( SUM ( 'Table'[value] ), FILTER ( ALLSELECTED ( 'Table' ), FORMAT ( EDATE ( 'Table'[date], 12 ), "YYYYMM" ) >= SELECTEDVALUE ( 'calendar'[yearmonth] ) && 'Table'[yearmonth] < SELECTEDVALUE ( 'calendar'[yearmonth] ) ) )If I misunderstood your meaning, please share some sample data and expected result.
Best Regards,
Jay
Anonymous
4 years agoNot applicable
Hi Jameswh91 ,
First create an independent yearmonth table as slicer.
calendar = distinct('Table'[yearmonth])
Then create a measure like below:
custom_LYTD =
CALCULATE (
SUM ( 'Table'[value] ),
FILTER (
ALLSELECTED ( 'Table' ),
FORMAT ( EDATE ( 'Table'[date], 12 ), "YYYYMM" )
>= SELECTEDVALUE ( 'calendar'[yearmonth] )
&& 'Table'[yearmonth] < SELECTEDVALUE ( 'calendar'[yearmonth] )
)
)
If I misunderstood your meaning, please share some sample data and expected result.
Best Regards,
Jay