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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
mapr
Frequent Visitor

Show sum previous month and specific month

Hi everybody, I have been missing for a some time.

 

I need a card that shows the units of the previous month or a specific month, the date field may contain duplicate records from what I understand I cannot use DATEADD unless I use an auxiliary table with dates in model. I have tried the latter but it does not work.

Any ideas? Thank you very much.

 

With this table the measure works, there are duplicates dates:

 

pbi 001.png

 

Also, I don't understand what I am doing wrong because this measurement works in one table but not in another:
Measure = CALCULATE(SUM('Table'[uds]),DATEADD('Table'[Date],-1,MONTH))

Shouldn't it indicate in both tables that there are duplicate dates?

 

This is the error:

pbi 002.png

1 ACCEPTED SOLUTION
mapr
Frequent Visitor

Ok, DATEADD is not ok, I need to use another formula to calculate this.

 

Finally, I have solved with this formula:

 

Penalizacion_Mes_Previo_VF = VAR _year = IF(MONTH(NOW())=1,YEAR(NOW())-1,YEAR(NOW()))
Return
CALCULATE(SUM(table[Uds]),AND(MONTH(table[date])=MONTH(NOW())-1,YEAR(table[date])= _year))

View solution in original post

1 REPLY 1
mapr
Frequent Visitor

Ok, DATEADD is not ok, I need to use another formula to calculate this.

 

Finally, I have solved with this formula:

 

Penalizacion_Mes_Previo_VF = VAR _year = IF(MONTH(NOW())=1,YEAR(NOW())-1,YEAR(NOW()))
Return
CALCULATE(SUM(table[Uds]),AND(MONTH(table[date])=MONTH(NOW())-1,YEAR(table[date])= _year))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors