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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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