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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Janaki
Regular Visitor

dax previousmonth

Hi,

 

I am trying use PREVIOUSMONTH to get the previous month value. My data looks like this

 

Capture.PNG

 

I calculated previous from current value using PREVIOUSMONTH, but i get one extra month March 2017.

Previousvalue =
CALCULATE(
'xyz'[CurrentValue],
PREVIOUSMONTH('xyz'[ReportDate].[Date]))

 

Can someone help me understand why am i getting March, though my date column stops at feb 2017?  Thank you,

1 ACCEPTED SOLUTION


@Janaki wrote:

Hi,

 

Thank you. The currentvalue that I am using is a measure. Would you have a alternate suggestion? 


@Janaki

Then just try

Previousvalue =
IF (
    ISBLANK ( MAX ( xyz[ReportDate] ) ),
    BLANK (),
    CALCULATE (
         'xyz'[CurrentValue],
        PREVIOUSMONTH ( dimdate[Date].[Date] )
    )
)

View solution in original post

3 REPLIES 3
Eric_Zhang
Microsoft Employee
Microsoft Employee


@Janaki wrote:

Hi,

 

I am trying use PREVIOUSMONTH to get the previous month value. My data looks like this

 

Capture.PNG

 

I calculated previous from current value using PREVIOUSMONTH, but i get one extra month March 2017.

Previousvalue =
CALCULATE(
'xyz'[CurrentValue],
PREVIOUSMONTH('xyz'[ReportDate].[Date]))

 

Can someone help me understand why am i getting March, though my date column stops at feb 2017?  Thank you,


@Janaki

It seems by design. If you don't like it, try to apply some tricks as

Previousvalue =
IF (
    ISBLANK ( MAX ( xyz[ReportDate] ) ),
    BLANK (),
    CALCULATE (
        SUM ( 'xyz'[CurrentValue] ),
        PREVIOUSMONTH ( dimdate[Date].[Date] )
    )
)

Hi,

 

Thank you. The currentvalue that I am using is a measure. Would you have a alternate suggestion? 


@Janaki wrote:

Hi,

 

Thank you. The currentvalue that I am using is a measure. Would you have a alternate suggestion? 


@Janaki

Then just try

Previousvalue =
IF (
    ISBLANK ( MAX ( xyz[ReportDate] ) ),
    BLANK (),
    CALCULATE (
         'xyz'[CurrentValue],
        PREVIOUSMONTH ( dimdate[Date].[Date] )
    )
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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.