Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Calculate Year to Date Year on Year Growth

Hi All,

 

I'm new to Power BI and just wanted to know how it is possible to create a year to date vs previous year bar chart. My source data is events data over the last few years - one record per event and multiple events per day. I can create a cluster bar chart that gives me a monthly comparison since the beginning of last year but alongside it i would like a chart that shows year to date comparison vs last year (based on the last full month).

 

Dummy data below as an example - summary by month and year (matrix) which can be plotted as a cluster bar and no additional manipulation to the source data required. The year to date figures will exclude the partial current month.

 

Month20182019 Period2018 YTD2019 YTD
Jan6191 Events441394
Feb8234    
Mar5024    
Apr194    
May5881    
Jun6225    
Jul8741    
Aug404    
Sep335    
Oct85     
Nov40     
Dec45     

 

Any ideas on how to proceed - do i need to create a separate summary table etc?

 

And as a separate question given my source data will be udpated every day how do i make both charts dynamic so i will only ever see the current year vs last year without having to hard code the years?

 

Thank You

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

we can try to use the following measure to meet your requirement.

 

ThisYear = 
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( 'Table', 'Table'[Date].[Year] = YEAR ( TODAY () ) )
)
LastYear = 
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( 'Table', 'Table'[Date].[Year] = YEAR ( TODAY () ) - 1 )
)

13.PNG14.PNG

 

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

we can try to use the following measure to meet your requirement.

 

ThisYear = 
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( 'Table', 'Table'[Date].[Year] = YEAR ( TODAY () ) )
)
LastYear = 
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( 'Table', 'Table'[Date].[Year] = YEAR ( TODAY () ) - 1 )
)

13.PNG14.PNG

 

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors