cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to select previous month and use it to calculate the sales of last month

I have the following table:

CodSaleSoldDate
11252018-05-10
21002018-05-15
31502018-05-20
4502018-06-20
5752018-06-25


I need to make a measure that returns me the following table:

MonthSoldLastMonth
May0
Jun375 (Sum of sales May)
Ago125 (Sum of sales Jun)

 

I tried to use PREVIOUSMONTH and EDATE(Date; -1) but doesn't work.
I will use this measure on a graph to see "Month Over Month".

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: How to select previous month and use it to calculate the sales of last month

Hi @gluizqueiroz

 

Have you got a Date table? Time intelligence functions are only guaranteed to work if you have a "complete" Date table.

If you don't, create one, place Month in rows of a matrix visual and this measure in values for the previous month sales:

 

SoldPreviousMonth =
CALCULATE ( SUM ( CodSales[Sold] ); PREVIOUSMONTH ( CalendarTable[Date] ) )

 

View solution in original post

2 REPLIES 2
LivioLanzo Super Contributor
Super Contributor

Re: How to select previous month and use it to calculate the sales of last month

hi @gluizqueiroz

 

in order to be able to use TIME INTELLIGENCE functions, you need to create a date dimension and link it to the fact tables:

 

http://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-3-public-holidays

 

 

 


 


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


Proud to be a Datanaut!  

Highlighted
Super User
Super User

Re: How to select previous month and use it to calculate the sales of last month

Hi @gluizqueiroz

 

Have you got a Date table? Time intelligence functions are only guaranteed to work if you have a "complete" Date table.

If you don't, create one, place Month in rows of a matrix visual and this measure in values for the previous month sales:

 

SoldPreviousMonth =
CALCULATE ( SUM ( CodSales[Sold] ); PREVIOUSMONTH ( CalendarTable[Date] ) )

 

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 139 members 1,783 guests
Please welcome our newest community members: