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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Osama14
Frequent Visitor

Show Pervious Year and Previous Month values

Hi, I am stuck in getting the value for the previous year and the previous month.

My Data set is number of KPI values added every Month, I want to create a measure that compares the total of the previous year against the total of this year or Month

Osama14_0-1635966929597.png

I am putting the KPI title in the  Filter and month name and the actual value of that KPI in the table visual. Note that I have a calendar table created in M query called Date Dimension.

I have tried multiple dax formulas but not been able to get it right and it shows blank

Previous = CALCULATE(SUM('KPI'[Actual_Value]),PREVIOUSMONTH('Date Dimension'[Date].[Date]))

Previous = CALCULATE(SUM('KPI'[Actual_Value]),PREVIOUSYear ('Date Dimension'[Date].[Date]))

Osama14_1-1635966929715.png


Appreciate you help

3 REPLIES 3
v-robertq-msft
Community Support
Community Support

Hi, 

According to the DAX formula and output pictures you posted, I think that the problem may exist in the table relationship between the calendar table with your main table. I suggest you to go to the relationship page to check if the filter direction is both and if the relationship is enabled.

If you still have a problem with this, you can post some sample data(without sensitive data) so that we can help you to find out the root cause.

How to Get Your Question Answered Quickly 

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

You don't specify if you are using measures or calculated columns. Beware of the filter context.

 

Note:  You may want to use DATEADD() instead, as the other functions (including SAMEPERIODLASTYEAR) are mostly syntax sugar.

Hi, I am creating a measure - I have tried the below but it's not working with all KPI's 

 

PREVLSV =
var _curYear = MAX('Date Dimension'[Year])
RETURN
CALCULATE(SUM('KPI'[Actual_Value]), FILTER(ALL('Date Dimension'), 'Date Dimension'[Year] = _curYear -1))

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.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.