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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Paulo123
Frequent Visitor

variation

I wanted to calculate the monthly change from the current month to the previous month. but I want it to display the results only when I select the month filter.

2 ACCEPTED SOLUTIONS
ValtteriN
Super User
Super User

Hi,

You can use ISFILTERED or HASONEFILTER to check if a slicer is applied and then use this in IF condition. 

e.g.
DAX:

LM IF FILTERED = IF(HASONEFILTER('Calendar'[Today].[Month]),
CALCULATE('Matrix example'[Measure 6],DATEADD('Calendar'[Date],-1,MONTH)),
BLANK())
 
End result (with and without filter):
ValtteriN_0-1642529460982.png

 

ValtteriN_1-1642529476313.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

I adapted the answer to my need

 

 

VAR MES% = if(HASONEFILTER(CALENDARIO[Date].[Mês]),
VAR _MES_ANTERIOR=CALCULATE(Dados[SOMA_E],DATEADD(CALENDARIO[Date],-1,MONTH))
RETURN
DIVIDE(Dados[SOMA_E] - _MES_ANTERIOR,_MES_ANTERIOR))

View solution in original post

2 REPLIES 2
ValtteriN
Super User
Super User

Hi,

You can use ISFILTERED or HASONEFILTER to check if a slicer is applied and then use this in IF condition. 

e.g.
DAX:

LM IF FILTERED = IF(HASONEFILTER('Calendar'[Today].[Month]),
CALCULATE('Matrix example'[Measure 6],DATEADD('Calendar'[Date],-1,MONTH)),
BLANK())
 
End result (with and without filter):
ValtteriN_0-1642529460982.png

 

ValtteriN_1-1642529476313.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I adapted the answer to my need

 

 

VAR MES% = if(HASONEFILTER(CALENDARIO[Date].[Mês]),
VAR _MES_ANTERIOR=CALCULATE(Dados[SOMA_E],DATEADD(CALENDARIO[Date],-1,MONTH))
RETURN
DIVIDE(Dados[SOMA_E] - _MES_ANTERIOR,_MES_ANTERIOR))

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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