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
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
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.