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
amybirc77
Helper II
Helper II

Get current month and previous month in two columns

Hi All,

I have a table which shows total charges, How to i get the values charges for the current month in one column and for the previous month in another column. I can set filters , but how can i do it automatically? without me going and changing it at the EOM. Please advice.

I am connecting to SSAS Cubes and We ddeploy this to the report server, my new measure is greyed out, to try something like this

current_month_sales = CALCULATE(SUM('Table1'[Sales]),FILTER('Table1',MONTH('Table1'[Month])=MONTH(TODAY())))

Thanks

1 ACCEPTED SOLUTION

FInally this worked

Current Month Value = CALCULATE(SUM('Transactions (2)'[Set 01 Charge Amount]),MONTH('Transactions (2)'[Charge Create Date.Date])=MONTH(TODAY()))
Thanks

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

If you have a Year Month column in your Date table then the measure for the current month could be

Current Month Sales =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    'Date'[Year Month] = FORMAT ( TODAY (), "YYYYMM" )
)

and previous month would be

Prev month sales =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    TREATAS ( { TODAY () }, 'Date'[Date] ),
    PREVIOUSMONTH ( 'Date'[Date] )
)

thanks @johnt75 I have a date heirarchy YEAR SALES.CREATEDATE,MONTH,QUARTER,YEAR.

So i used this

Current Month Sales1 =
CALCULATE (
SUM ( 'Transactions'[Set 01 Charge Amount] ),
'Transactions'[Charge Create Date.Month] = FORMAT ( TODAY (), "YYYYMM" )
)

And it did not return nothing at all.

I tried this as well and did not get any values. Please advice

Previous = CALCULATE(SUM('Transactions (2)'[Set 01 Charge Amount]),PREVIOUSMONTH('Transactions (2)'[Charge Create Date.Date]))
 

Thanks

FInally this worked

Current Month Value = CALCULATE(SUM('Transactions (2)'[Set 01 Charge Amount]),MONTH('Transactions (2)'[Charge Create Date.Date])=MONTH(TODAY()))
Thanks

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.