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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
metcala
Helper III
Helper III

Current month value using YTD minus previous month YTD

Hi

 

Sorry for the basic question.

 

I currently have a table with the following

 

DateUnitActivityYTD
30/1/23AX

10

30/1/23AY15
30/1/23AZ5
30/1/23BY20
30/1/23BZ5
28/2/23AX

15

28/2/23AY25
28/2/23AZ15
28/2/23BY25
28/2/23BZ15

 

Currently trying to write a measure that will allow the following output

 

DateUnitActivityMonthly Total
30/1/23AX

10

30/1/23AY15
30/1/23AZ5
30/1/23BY20
30/1/23BZ5
28/2/23AX

5

28/2/23AY10
28/2/23AZ10
28/2/23BY5
28/2/23BZ10

 

This is as far as I've got.... doesn't reflect unit/activity but couldn't even get previous month YTD working.

 

 

Monthly Total = CALCULATE(
SUM('Table'[YTD]),
FILTER('Table','Table'[Date]=EOMONTH('Table'[Date],-1))
)

 

 

Any help would be much appreciated!

1 ACCEPTED SOLUTION

or like:

Column2 = 
[YTD]-
CALCULATE(
    SUM(data[YTD]),
    data[date]=EOMONTH(EARLIER(data[date]), -1),
    ALLEXCEPT(data, data[Unit], data[Activity])
)

FreemanZ_1-1683856002700.png

View solution in original post

9 REPLIES 9
FreemanZ
Super User
Super User

hi @metcala 

why Jan 30 not 31? what other values do you have for the date column?

@FreemanZ  Apologies this was just me adding the incorrect date for the example data.

so the actual data is?

@FreemanZ As the data itself is sensitive I've anonymised the field names but the categories are the same as the original data.

hi @metcala 

by actual data, i mean Jan 30 or 31?

Sorry it is always the end of the month so 31 Jan...my bad

or like:

Column2 = 
[YTD]-
CALCULATE(
    SUM(data[YTD]),
    data[date]=EOMONTH(EARLIER(data[date]), -1),
    ALLEXCEPT(data, data[Unit], data[Activity])
)

FreemanZ_1-1683856002700.png

 

@FreemanZ 

 

Thank you very much for your help!

 

Much appreciated!

hi @metcala 

it is always good to clarify first and no harm is done. 

please try to add a calculated column like:

Column = 
[YTD]-
MAXX(
    FILTER(
        data,
        data[date]=EOMONTH(EARLIER(data[date]), -1)
            &&data[Unit]=EARLIER(data[Unit])
            &&data[Activity]=EARLIER(data[Activity])
    ),
    data[YTD]
)

it worked like:

FreemanZ_0-1683855846970.png

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.