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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.