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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
kasife
Helper V
Helper V

Total sales for the previous month by salesperson

Hi Guys,
I'm trying to get last month's total sales for each salesperson. But as I'm using it, it's not working. What's wrong with the measurement?

Meta por supervisor LM = 
CALCULATE(
    [_Total vendas],
         DATEADD(d_calendario[Date],-1,MONTH))

kasife_0-1687307542940.png

 

1 ACCEPTED SOLUTION

I test with simple data and it came out like this.

 

ProjectKM_0-1687322151806.png

ProjectKM_1-1687322463115.png

Is the result you want the same as above?

 

View solution in original post

6 REPLIES 6
ProjectKM
Frequent Visitor

There seems to be no problem with measure.

Check d_calendario has a Mark as date table set or check the connection between d_calendario and fact table

Hi @ProjectKM 

I checked and the relationship is ok. When I use segmentation it works

kasife_0-1687321008525.png

 

I test with simple data and it came out like this.

 

ProjectKM_0-1687322151806.png

ProjectKM_1-1687322463115.png

Is the result you want the same as above?

 

@ProjectKM 
I 'd like a measure without using date slicer.

Oh, I understood. Then try this.

_LM = 
CALCULATE(
[_Total Amount],
FactTable[YYYYMM] = FORMAT(EDATE(TODAY(), -1), "YYYYMM")
)

Write the date you want in the TODAY() part.

 

@ProjectKM 
I used this measure and its working. Thanks

   VAR _toDay= TODAY()
   VAR  _EndtDate = EOMONTH( _toDay,-1)
   VAR _StartDate = EOMONTH( _toDay,-2)+1
 RETURN
CALCULATE(
    [_Total vendas],
    d_calendario[Date] >= _StartDate && d_calendario[Date] <=_EndtDate)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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