cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
smithshire
Frequent Visitor

Show Current Month and Previous Month Data

Hi,

 

I have 3 measures as follows:-

 

TotalTraining =CALCULATE (SUM (ADV_NOTE_LINES[AVL_AMOUNT]),
FILTER ( ALL ( ADVICE_NOTES[AVN_TYPE] ), ADVICE_NOTES[AVN_TYPE] = "TRAINING" ))
 
TotCredit =CALCULATE (SUM (HIL[IVL_CHARGE]),
FILTER ( ALL ( HI[IVC_INVOICE_TYPE] ), HI[IVC_INVOICE_TYPE] = "CREDIT" ))
 
TotHire =CALCULATE (SUM (HIL[IVL_CHARGE]),
FILTER ( ALL ( HI[IVC_INVOICE_TYPE] ), HI[IVC_INVOICE_TYPE] <> "CREDIT" ))
 
Which I use to calculate the overall spend of a customer in another measure:-
 
Overall =[TotHire]+[TotalTraining]-[TotCredit]
 
I have a calendar table.
 
I can display the monthly totals for each customer using a month/year date slicer:-
smithshire_1-1653902593086.png

 

How can I also display the the previous month total based on the slicer selection for each customer?

 
1 ACCEPTED SOLUTION
Tahreem24
Super User
Super User

@smithshire Try this below DAX Measure:

MEASURE = CALCULATE([Overall], DATEADD(TableName[DateColumn],-1,MONTH))

 

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 , and Fortune 500 Companies Analysis

View solution in original post

3 REPLIES 3
smithshire
Frequent Visitor

That worked exactly as I wanted is to, many thanks.

@smithshire You are most welcome! Happy to help 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 , and Fortune 500 Companies Analysis
Tahreem24
Super User
Super User

@smithshire Try this below DAX Measure:

MEASURE = CALCULATE([Overall], DATEADD(TableName[DateColumn],-1,MONTH))

 

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 , and Fortune 500 Companies Analysis

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

Check it Out!

Mark your calendars and join us on Thursday, September 29 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors