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
irakhman
Regular Visitor

Dynamic Filter Based on Slicer Selection

Hello experts, need help solving a puzzle.  Thank you muchly in advance for any help.  Relatively new to Power BI.  

 

I have a simple model.  A large fact table, and a date dimension.  As you can see in the Viz below, I have a slicer based on the SHD Date YearMonth field (numeric).  Selection can filter the History table with no issue, but what I need to achieve is when a selection is made, I need to filter on two values: one selected, and another one calculated.  For example, if a user selects 202102, I need it selected but also 202012 chosen as well.  Basically, it's 202102 - 100.  I can not, for the life of me, write a dax statement which would allow me to use two values - one selected, and one calcualated via the slicer.  HELP???  😞

Model.PNGViz.PNG

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @irakhman ,

 

Try to use DATESINPERIOD function. Here are some samples you can refer to:

Display Last N Month and Selected Month Data using Date Dimension in Power BI (helicaltech.com);

powerbi-data2.png

 

Display Last N Months & Selected Month using Single Date Dimension in Power BI – Some Random Thought....

image_thumb-4.png

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Icey
Community Support
Community Support

Hi @irakhman ,

 

Try to use DATESINPERIOD function. Here are some samples you can refer to:

Display Last N Month and Selected Month Data using Date Dimension in Power BI (helicaltech.com);

powerbi-data2.png

 

Display Last N Months & Selected Month using Single Date Dimension in Power BI – Some Random Thought....

image_thumb-4.png

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.