Forum Discussion

Success's avatar
Success
Regular Visitor
7 years ago
Solved

Year over year comparison

Hi,

 

I have a requirement to create a visualization showing profit comparision of last 3 years 2016,2017 and 2018. I have to show this by last 13 weeks from current week. I need to use the line chart visualization for this.

 

I have following data

GrossProfit, Year, WeekEndingDate in one table.

Calendar table.

 

Can anyone please let me know how I can achieve this?

 

Thanks in advance.

 

Regards,

Success

  • Hi Success

    Would you like to show the profit comparision the same week periods in the year 2016,2017,2018?

    Create a calculated column based on the WeekEndingDate in one table

    weeknum = WEEKNUM([WeekEndingDate],1) 

    Then create a measure

    last 13 weeks from current week = var today=TODAY() var currentweek=WEEKNUM(today,1) 
                            return IF(MAX([weeknum])<=currentweek&&MAX([weeknum])>currentweek-13,1,0)

    Add weeknum in the Axis, year in the category, GrossProfit in the value field, add measure last 13 weeks from current week in the visual level filter and show items when value is 1.

     

    Best Regards

    Maggie

1 Reply

  • v-juanli-msft's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity Support

    Hi Success

    Would you like to show the profit comparision the same week periods in the year 2016,2017,2018?

    Create a calculated column based on the WeekEndingDate in one table

    weeknum = WEEKNUM([WeekEndingDate],1) 

    Then create a measure

    last 13 weeks from current week = var today=TODAY() var currentweek=WEEKNUM(today,1) 
                            return IF(MAX([weeknum])<=currentweek&&MAX([weeknum])>currentweek-13,1,0)

    Add weeknum in the Axis, year in the category, GrossProfit in the value field, add measure last 13 weeks from current week in the visual level filter and show items when value is 1.

     

    Best Regards

    Maggie