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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Sadr_Hoda
Frequent Visitor

Last year sum

Hi,

 

I am unable to calculate last year cumulative sum for Dynamic table like with MTD and YTD.

 

below formula I use for current year and working perfectly.

 

Current Period MTD/YTD =
SWITCH([SelectedPeriod],
1, [Total current year consol.],
2, CALCULATE([Total current year consol.], DATESYTD('Calendar'[Date])))
 
Thanks in advance
3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Sadr_Hoda 

 

Please try this measure

LY Period MTD/YTD =
SWITCH (
    [SelectedPeriod],
    1, CALCULATE ( [Total Sales], DATEADD ( 'Calendar'[Date], -1, YEAR ) ),
    2, CALCULATE ( [Total Sales], DATESYTD ( DATEADD ( 'Calendar'[Date], -1, YEAR ) ) )
)

 

In above example, Total Sales is a simple measure with SUM: Total Sales = SUM('Table'[Sales])

 
 
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Thanks for your advise, however, it is not working.

 

I am unable to compute cumulative prior period balance. 

 

I have a data from 2016 onwards and want to compare month to month and period to period wise.

 

Hi @Sadr_Hoda 

 

I may misunderstand your requirement. Can you please provide some dummy data or give some examples to explain what you want? Is this blog close to what you want? Creating a Power BI Chart Comparing Each Year vs Previous Year - Carl de Souza I guess your period could be month or year or something else and is dynamic?

 

Best Regards,

Jing

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors