Forum Discussion

Composed_MS's avatar
Composed_MS
Icon for Helper I rankHelper I
3 years ago

Issue in YTD trend

Hello, I am facing issue in showing the YTD trend for the below source table.

 

Source table ->

YTD logic for March month = Sum of Jan users+Sum of Feb users+ Sum of March users

                                                                                          3
For March Amazon =(500+200+300)/3=333.33

The measure I am using is ->

Measure =
AVERAGEX(
SUMMARIZE(
SUMMARIZE(

    CALCULATETABLE(
        Traffic,DATESYTD('Calendar'[Date])
        )
    ,Traffic[Month],"Users",SUM(Traffic[User])),
    [Users]),
    [Users])

It is giving me correct value in card but in the trend it is giving monthly value.
 

 

My model -> To show previous month's trend as well, I have created the Calendar2 table and my X axis is Month Year from Calendar2 table.

 

Measure for Trend=

Trend =
var previous_dates=DATESINPERIOD('Calendar2'[Date],MAX(Calendar[Date]),-3,MONTH)
return
 CALCULATE([Measure],
    REMOVEFILTERS('Calendar'),
    KEEPFILTERS(previous_dates),
    USERELATIONSHIP('Calendar'[Date],Calendar2[Date]))

Please help me in showing trend for YTD calculation.