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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Calculate previous month value based on selected dates

I have following data set:

DateValue
1.2.2019400
15.2.201950
23.2.2019100
24.2.2019150
5.3.201980
19.3.201920
23.3.201935
25.3.201970
1.4.201915

 

I like to give end user a change to filter dates and after that calculate value for the last month... based on selected values:

 

 ValuePrevMonth
23.2.2019100 
24.2.2019150 
5.3.201980250
19.3.201920250
1.4.201915100

 

I have been trying to do this many ways already and don't seem to get it to work. Can anyone help me with this?

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous 

 

You may try below measure:

Measure = 
CALCULATE (
    SUM ( Table1[Value] ),
    FILTER (
        ALLSELECTED ( Table1 ),
        MONTH ( Table1[Date] )
            = MONTH ( MAX ( Table1[Date] ) ) - 1
    )
)

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
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

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous 

 

You may try below measure:

Measure = 
CALCULATE (
    SUM ( Table1[Value] ),
    FILTER (
        ALLSELECTED ( Table1 ),
        MONTH ( Table1[Date] )
            = MONTH ( MAX ( Table1[Date] ) ) - 1
    )
)

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-cherch-msft ,

 

It is not work when we have 2 years of data i.e., 2018 and 2019. Is is working when we have 1 year data alone. It is getting summed up for nov month 2019 as well as 2018 whenever the month value is returning as 11.

 

Thanks

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors