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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
PBIBeginner2022
Helper III
Helper III

DAX function SUM filtered by current month -1

Hello everyone,

 

I have a table with theses information:

 

 

ORDER NUMBERPRICE (€)Delivery date
ORD0011322/01/2019
ORD0027817/12/2021
ORD0037307/01/2019
ORD0045202/07/2020
ORD0051309/03/2019
ORD0065428/08/2022
ORD0072601/05/2022
ORD0082402/05/2022
ORD0097403/05/2022
ORD0105104/05/2022
ORD0113005/05/2022
ORD0125706/05/2022
ORD0131407/05/2022
ORD0145708/05/2022
ORD0151109/05/2022
ORD0165710/05/2022
ORD0173311/05/2022
ORD0181412/05/2022
ORD0191913/05/2022
ORD0206914/05/2022
ORD0216515/05/2022
ORD022903/09/2019
ORD0232817/08/2022
ORD0245930/04/2021
ORD0257222/06/2020
ORD0261830/11/2021
ORD0277324/08/2019
ORD0281213/10/2022
ORD0291126/01/2023
ORD030302/07/2019
ORD0313929/05/2022
ORD032914/05/2020
ORD0334413/05/2020
ORD0347816/05/2020
ORD0352124/09/2023
ORD0364527/03/2023
ORD0371004/08/2021
ORD0387105/02/2020
ORD0394124/08/2022
ORD040214/03/2020

 

The second column is a calculate column with other table. However, I need to create a mesure to display the sum of prices of last month. For exemple, we are in June 2022, I want see my sum of sales of May 2022. My DAX measure need to calculte the sum for the period between 01/05/2022 and 31/05/2022. Or it depends of the months with 30 or 29 days. I don't want to select data in order to I have automaticaaly measure when the month change, for exemple, in July 2022, I want see the sum of sales of June 2022 and in Septembre 2022, I want see the sum of sales of August 2022.

 

Thanks in advance.

1 ACCEPTED SOLUTION

@vojtechsima  I don't have slicer on my sheet and they are data on previous month. I have data all months of all years 

View solution in original post

5 REPLIES 5
vojtechsima
Super User
Super User

Hi, @PBIBeginner2022 
If you have a calendar, write something like this:

CALCULATE(SUM('Table'[NUMBERPRICE (€)]), PREVIOUSMONTH('Calendar'[Date]))

Hi @vojtechsima ,

 

When I use my table "calendar" (it's a table with date of all of days between  1988 and 2030), it's wrote "vide" or "blank" in english ... I don't see the value of what I want calculate.

 

PBIBeginner2022_0-1654764280608.png

 

@PBIBeginner2022  DO you have a slicer that picks a certain value (date)? Are there data for the previous month in the selected date?

@vojtechsima  I don't have slicer on my sheet and they are data on previous month. I have data all months of all years 

Can you use it in a visual with date column inside of that visual, let's say a Table and lemme know if that works?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.