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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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