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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Previous Month data for more than 1 year based on selection

Hi All,

 

I have 2 columns in my data set Date and Marks. I would like to create an output column which will show previous months value(Note: I have data from 2018 as well as 2019). Also then i would like to create comparison column which will show the difference between Marks and output column and that is pretty straigh forward. But mainly i would like to create the output column.

 

Previous Month.PNG

 

Also in the below URL we have solution but it is not working properly when more than 1 year is involved.

 

https://community.powerbi.com/t5/Desktop/Calculate-previous-month-value-based-on-selected-dates/m-p/...

 

Thanks in Advance.

1 ACCEPTED SOLUTION
Tahreem24
Super User
Super User

Hi @Anonymous ,

 

Create Measure like below:

Prev_Month_Marks = CALCULATE(sum(Sheet9[Marks]),PREVIOUSMONTH(Sheet9[Date]))
 
I have replica your issue at my end and got the expected output. (Screen shot is attached)
Capture.JPG
 
Please hit Thumbs up for support and accept this as a solution if it helps you!
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

View solution in original post

4 REPLIES 4
Tahreem24
Super User
Super User

Hi @Anonymous ,

 

Create Measure like below:

Prev_Month_Marks = CALCULATE(sum(Sheet9[Marks]),PREVIOUSMONTH(Sheet9[Date]))
 
I have replica your issue at my end and got the expected output. (Screen shot is attached)
Capture.JPG
 
Please hit Thumbs up for support and accept this as a solution if it helps you!
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

@Anonymous ,

 

Let me know whether my solution met your requirement or not.

 

Dont forget to hit Thumbs up and also accept this as a solution if it helps you!

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

Hi @Tahreem24 ,

 

Yes!! Thanks for your help!!

My Pleasure @Anonymous.

 

Keep learning and Good Luck buddy!

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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