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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Jan03
Frequent Visitor

Dynamic Complex Filtering with slicers

Hello, I have a question.

I am learning Power BI and I want to implement dynamic filtering based on user interaction within the dashboard.

Specifically, I need the user to select a date from a list, and then have that selected date used internally to perform a calculation: adding one month to it.

After that calculation, the resulting date needs to be compared against two fields in a fact table: Fecha and Vencimiento. The logic should work as follows:

 

  • The selected date plus one month must be greater than or equal to the Vencimiento field.
  • It must also be less than the Fecha field. This would allow me to filter all records in the fact table that meet those conditions.

The idea is to show in different graphics all of the registers that satisfy the condition described before. I initially tried to accomplish this using slicers, but from what I’ve tested so far, slicers only filter directly by fields. In other words, I haven’t been able to create more complex or computed filters using slicers alone.

14 REPLIES 14
v-echaithra
Community Support
Community Support

Hi @Jan03

Please find the attached PBIX file below. I hope it meets your requirements.

Kindly review it and let me know if you need any further adjustments or clarifications. If the issue still persist please share a sample PBIX file with sample output.

vechaithra_2-1772099582046.png

Thank you.

v-echaithra
Community Support
Community Support

Hi @Jan03 ,

Just checking in to see if you had a chance to follow up on our earlier conversation. If you're still encountering the issue, please share the sample data so we can assist you with an accurate solution.

If you have any further questions, feel free to reach out anytime.



Thank you for your patience and look forward to hearing from you.
Best Regards,
Chaithra E.

Like i said in your message before, the problem hasn't been resolved.

v-echaithra
Community Support
Community Support

Hi @Jan03 ,

I just wanted to check if the issue has been resolved on your end, or if you require any further assistance. Please feel free to let us know, we’re happy to help.

If possible, could you also share a sample PBIX file (without any sensitive information) or some sample data that mimics your scenario? This will help us better understand your requirement and provide possible approaches.

How to provide sample data in the Power BI Forum - Microsoft Fabric Community


Thank you.

v-echaithra
Community Support
Community Support

Hi @Jan03 ,

Right now your slicer table is correctly disconnected, but your row-level measure is being evaluated in an aggregated context, so MIN() or SELECTEDVALUE() isn’t reliably pulling the current row’s Fecha/Vencimiento. That’s why it always returns false.

Try again with this measure:


InRange =
VAR SelDate = SELECTEDVALUE ( SlicerDate[Date] )

VAR SelPlus1 =
EDATE ( SelDate, 1 )

VAR RowVenc =
SELECTEDVALUE ( Fact[Vencimiento] )

VAR RowFecha =
SELECTEDVALUE ( Fact[Fecha] )

RETURN
IF (
NOT ISBLANK ( SelDate ) &&
NOT ISBLANK ( RowVenc ) &&
NOT ISBLANK ( RowFecha ) &&
SelPlus1 >= RowVenc &&
SelPlus1 < RowFecha,
1, 0)

For each visual you want filtered drag InRange into Visual-level filters and set it to is 1.

Hope this helps.
Thank you.

It doesn't work, but I appreciate your time. The measure is always 0, but like i said before, the problem isnt the data because when i apply filters in each object like the image, it works. 

Jan03_0-1770044333465.png

 

cengizhanarslan
Super User
Super User

1) Create a slicer table (disconnected)

Use a date table just for the slicer (it must not relate to the fact table):

SlicerDate =
CALENDAR ( DATE(2020,1,1), DATE(2035,12,31) )

Put SlicerDate[Date] on a slicer.

 

2) Create a measure that flags valid fact rows

InRange (row) =
VAR SelDate = SELECTEDVALUE ( SlicerDate[Date] )
VAR SelPlus1 = EDATE ( SelDate, 1 )
VAR Venc = MIN ( Fact[Vencimiento] )
VAR Fec  = MIN ( Fact[Fecha] )
RETURN
IF (
    NOT ISBLANK ( SelDate )
        && SelPlus1 >= Venc
        && SelPlus1 < Fec,
    1,
    0
)

 

3) Apply it to visuals

For each visual you want to filter:

  • Drag InRange (row) into the visual-level filters

  • Set it to is 1

This will make the visual only show records where:

SelectedDate + 1 month >= Vencimiento and SelectedDate + 1 month < Fecha

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

Thanks, but it doesnt work. I did exactly what you said. Probably i made a mistake in the medium steps. And the problem isn't the data.

Jan03_0-1769706477571.pngJan03_1-1769706508610.png

Jan03_3-1769706588447.png

 

 

I think the only issue is that your initial variable is potentially pointed to the calendar table that has a relationship to the fact table and not the disconnected SlicerDate[Date] table you created for the slicer.

-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃
Jan03
Frequent Visitor

I cant see a relationship between tables. The calendar table (which creates the slicer) is apart.

Jan03_0-1769707660847.png

 

Ashish_Mathur
Super User
Super User

Hi,

I have solved a similar question in the attached file.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
d_m_LNK
Super User
Super User

Hi There!

Please consider this solution:

 

Step 1: Create a disconnected Calendar table in your data model All the calendar references in these measures must be to the disconnected table

 

Step 2 Date Slicer: Use the Drop Down slicer style with your date field but add other fields to make selection easier. Add Year, Quarter, Month, Date to the fields section of the date slicer and this will allow you to pick a specific date.

d_m_LNK_0-1769553847984.png

 

Step 3 Measure to select the date:  Create a measure like this:

Selected Date = Max(Calendar[date])  --this grabs the max date in the selected context

 

Step 4 Add Date Measure:

AddOneMonth = 

VAR _DateSelected = [SelectedDate]
VAR _AddOneMonth = CALCULATE( DATEADD( Calendar[Date], 1, MONTH ), Calendar[Date] = _DateSelected )

RETURN _AddOneMonth

 

Step 5 Criteria Measure:

MeetsCriteria =
SWITCH(TRUE(),
Table[Fecha] > [AddMonthToSelected] && Table[Vencimiento]< [AddMonthToSelected],
1, 0
)

 

Step 6: Add this column to your table visual and use the filter pane to filter to the value you are desiring

 

-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃
Jan03
Frequent Visitor

Thats the thing i wanted, but im having trouble with the step 5. The column you described at the step 5 is always false. Probably i did one of the previous steps wrong, but the measure of the steps 3 and 4 with its respective value seems okay, their values update in real time when i choose one or other option in the slicer. 

Jan03_0-1769632459468.png

 

Make sure that the correct comparisons are happening for the correct table.  Also I think I forgot something in the last measure:
MeetsCriteria =
SWITCH(TRUE(),
SelectedValue(Table[Fecha]) > [AddMonthToSelected] && SelectedValue(Table[Vencimiento])< [AddMonthToSelected],
1, 0
)

-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.