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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
atul9063
Helper III
Helper III

Calculate Previous Month Without Using Measure

Hi Team,

 

I have to calculate Prev month Value in column without using measure .

 

Currently, i m using below formula in measure to calculate previous month.But i want same output using caluclated column

PreviousMonthMetrics = CALCULATE([Totalmetric],DATEADD(Calender[Date],-1,MONTH))

 

image.png

 

3 ACCEPTED SOLUTIONS

@atul9063

 

Try this one

 

Column =
CALCULATE (
    SUM ( Table1[MetricValue] ),
    DATEADD ( Table1[Date], -1, MONTH ),
    ALLEXCEPT ( Table1, Table1[Date] )
)

 or this one

 

Column =
CALCULATE (
    SUM ( Table1[MetricValue] ),
    FILTER (
        Table1,
        Table1[Date].[MonthNo]
            = EARLIER ( Table1[Date].[MonthNo] ) - 1
    )
)

View solution in original post

@atul9063

 

Did you use first formula?

Could you show your formula?

 

Column =
CALCULATE (
    SUM ( Table1[MetricValue] ),
    DATEADD ( Table1[Date], -1, MONTH ),
    ALLEXCEPT ( Table1, Table1[Date] )
)

View solution in original post

Hi @atul9063,

 

By my tests, the last formula from Zubair_Muhammad should solve your problem.

 

Capture.PNG

 

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
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

9 REPLIES 9
PattemManohar
Community Champion
Community Champion

@atul9063 Please try this as a "New Column"

 

PrevMetric = LOOKUPVALUE(Test56PrevVal[Metric],Test56PrevVal[Date],DATEADD(Test56PrevVal[Date],-1,MONTH))

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




I m getting below error.Could you please help

 

image.png

@atul9063 You are not referencing the correct field in the third parameter of LOOKUPVALUE. Please try this..

 

PreviousMonthMetricValue = LOOKUPVALUE(vw_Engmt_Metrices[MetricValue],vw_Engmt_Metrices[dt],DATEADD(vw_Engmt_Metrices[dt],-1,MONTH))




Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




@PattemManohar  I m referencing third parameter as vw_Engmt_Metrices[dt],even then I m getting same error.

 

image.png

@atul9063

 

Try this one

 

Column =
CALCULATE (
    SUM ( Table1[MetricValue] ),
    DATEADD ( Table1[Date], -1, MONTH ),
    ALLEXCEPT ( Table1, Table1[Date] )
)

 or this one

 

Column =
CALCULATE (
    SUM ( Table1[MetricValue] ),
    FILTER (
        Table1,
        Table1[Date].[MonthNo]
            = EARLIER ( Table1[Date].[MonthNo] ) - 1
    )
)

@Zubair_Muhammad  I have used below formula and not able to get desired result.March 1,2017 values didnt match with Feb 1,2017 value

 

image.png

Hi @atul9063,

 

By my tests, the last formula from Zubair_Muhammad should solve your problem.

 

Capture.PNG

 

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best  Regards,

Cherry

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

Sorry for late for reply.Its working now 

 

Thanks for the solution !!

@atul9063

 

Did you use first formula?

Could you show your formula?

 

Column =
CALCULATE (
    SUM ( Table1[MetricValue] ),
    DATEADD ( Table1[Date], -1, MONTH ),
    ALLEXCEPT ( Table1, Table1[Date] )
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.