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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bilingual
Helper V
Helper V

Previous Month as filter not as running value

Hi, i have made the formula 

Last Month = CALCULATE(SUM(Data_akk[Antal rejser]);PREVIOUSMONTH(Kalender[Dato]))
It works fine as a variable, but what i need is PREVIOUSMONTH as a filter, so my graph every month only shows the values of last month, can anybody help? 🙂
 
i have made Calender table in M , should i add there?
 
Kindr regards Daniel
 

 

1 ACCEPTED SOLUTION
inna_sysco
Helper II
Helper II

Hi @bilingual !

I am assuming that you can create a calculated column in your Calendar table and determine the "previous month" with a similar formula:

Prev_month = IF (
AND (
'Calendar'[Date]
>= DATE ( YEAR ( NOW () ), MONTH ( NOW () ) - 1, 1 ),
'Calendar'[Date]
<= DATE ( YEAR ( NOW () ), MONTH ( NOW () ), 1 ) - 1
),
"*Previous month",
'Calendar'[MonthName]&" "&'Calendar'[Year]
)


Then it will not be a problem to use this column as a visual and page-level filter. 

Best wishes, Inna

View solution in original post

5 REPLIES 5
inna_sysco
Helper II
Helper II

Hi @bilingual !

I am assuming that you can create a calculated column in your Calendar table and determine the "previous month" with a similar formula:

Prev_month = IF (
AND (
'Calendar'[Date]
>= DATE ( YEAR ( NOW () ), MONTH ( NOW () ) - 1, 1 ),
'Calendar'[Date]
<= DATE ( YEAR ( NOW () ), MONTH ( NOW () ), 1 ) - 1
),
"*Previous month",
'Calendar'[MonthName]&" "&'Calendar'[Year]
)


Then it will not be a problem to use this column as a visual and page-level filter. 

Best wishes, Inna

Hi Inna, it works almost, however, it only adds last month for the first date of the month, example 1 of february

@bilingual , hmm, it's a bit strange...
I use the same formula and result on the screenshot below:

inna_sysco_0-1615287673086.png
Could you, please, share some screenshots from your report?

 

Thanks a lot Inna, it was my mistake in the formula !

@bilingual , you're welcome!😉

Inna

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.