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
Anonymous
Not applicable

Dynamically filter on current month - 1

Greeting lovely members . 

i have a simple power bi report that i want to make it Dynamic . 

My data base is simple , here is a sample :

rfrikha_0-1616610714672.png

let's say this is the table where it contains the data that i will use in my visuals , i have also a Date table and table for the teams . 

what's im trying to make here is a measure that will filter automatically on the current month - 1 . 

Ex : since we are in march , in one of my visual i want to show only the data of the current month - 1 which is Febrary . how can i acheive this .
also is it possible to set the YTD function dynamically ? stop the count at the current month-1 ?

 

Thanks all in advance .  

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Here is the trick : 

Current month test = if (FORMAT(DATEADD('Date'[Full date],1,MONTH),"mm yyyy")=FORMAT(TODAY(),"mm yyyy"),"true","false")
Last year Current month test = if (FORMAT(DATEADD(DATEADD('Date'[Full date],1,YEAR),1,MONTH),"mm yyyy")=FORMAT(TODAY(),"mm yyyy"),"true","false")
 
all i need to do is to filter my visuals based on these 2 columns and it solves the trick 😊
 
 

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I hope I understand your question correctly.

 

please try to follow the below.

if it does not work, please let me know.

 

 

yourmeasure Previous Month = CALCULATE( yourmeasure, DATEADD('Table'[Date], -1, MONTH))
 
yourmeasure YTD until previous month =
CALCULATE( yourmeasure, FILTER(ALLSELECTED('Table'[Date]), 'Table'[Date] <= EOMONTH(
MAX('Table'[Date]) 
, -1) && 'Table'[Year] = MAX('Table'[Year])))
 
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

First of all Thanks for you answer . 

 

i think i find a way to solve it , i was thinking to add a column in my Date table called Previous Month that have values (True or false) and based on that column i filter my visuals , can u help me build that calculated columns . 

i was able to create a column that return true or false for the current month using this Dax funtion : 

Current month test = if (FORMAT('Date'[Full date],"mm yyyy")=FORMAT(TODAY(),"mm yyyy"),"true","false")
 
rfrikha_0-1616615648395.png

 

Anonymous
Not applicable

Here is the trick : 

Current month test = if (FORMAT(DATEADD('Date'[Full date],1,MONTH),"mm yyyy")=FORMAT(TODAY(),"mm yyyy"),"true","false")
Last year Current month test = if (FORMAT(DATEADD(DATEADD('Date'[Full date],1,YEAR),1,MONTH),"mm yyyy")=FORMAT(TODAY(),"mm yyyy"),"true","false")
 
all i need to do is to filter my visuals based on these 2 columns and it solves the trick 😊
 
 

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.