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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
itsranga
Frequent Visitor

how to capture the value entered for relative Date slicer selection

Hi, I have a relative date slicer how to capture the entered value?

 

i have a measure i passed static value of 4 , instead of this i need to pass the relative slicer entered value 

 

this is my measure

 

Measure = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(Table1[CreatedDate]) = BLANK(), 1,
    SELECTEDVALUE(Table2[Schedule date]) <= SELECTEDVALUE(Table1[CreatedDate]) &&
    SELECTEDVALUE(Table2[Schedule date]) >= SELECTEDVALUE(Table1[CreatedDate]) - 4, 1,
    0
)

 

 

in this measure used for top table row filter based bottom table value filtering so i need to change dynamically pass slicer entered value

 

Reference 

 

itsranga_0-1738344690331.png

 

 

i have attached sample data 

 

Download sample file 

 

Thanks

 

3 ACCEPTED SOLUTIONS
wini_R
Solution Supplier
Solution Supplier

Hey @itsranga,

That could possibly be a difference between today's date and min date in filter context. You can check the following approach:

relativeDays = 
VAR _minDate = MIN(calTab[Date])
VAR _diff = TODAY() - _minDate
RETURN INT(_diff)+1

wini_R_0-1738348242329.png

Hope it helps!

View solution in original post

@vanessafvg @wini_R 

 

I have attached pbix file for your reference, i have 2 table top table if i select any row created date based  bottom table filter  schduled date to below 4 tables ,

 

instead of Staic value of 4 days i need dynamically filter selected row - slicer enterd date  this one im using measure

relativeDays = 
VAR _minDate = MIN(calTab[Date])
VAR _diff = TODAY() - _minDate
RETURN INT(_diff)+1

this is working im getting slicer enterd date but if i pass the value to measure means its not working

View solution in original post

@itsranga, I believe it works fine, there are likely some other issues in your report/data model, i.e. why would you have the interaction between visuals disabled?

wini_R_0-1738589221618.png

 

View solution in original post

8 REPLIES 8
vanessafvg
Super User
Super User

you have defined what your expected result is?  this would be needed to test the solution.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




@vanessafvg @wini_R 

 

I have attached pbix file for your reference, i have 2 table top table if i select any row created date based  bottom table filter  schduled date to below 4 tables ,

 

instead of Staic value of 4 days i need dynamically filter selected row - slicer enterd date  this one im using measure

relativeDays = 
VAR _minDate = MIN(calTab[Date])
VAR _diff = TODAY() - _minDate
RETURN INT(_diff)+1

this is working im getting slicer enterd date but if i pass the value to measure means its not working

Hey @itsranga,

Have you tried to add the measure that I suggested as a first step and then using it in your main measure? Doesn't that work as expected?

 

This is how it should look like:

Measure = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(Table1[CreatedDate]) = BLANK(), 1,
    SELECTEDVALUE(Table2[Schedule date]) <= SELECTEDVALUE(Table1[CreatedDate]) &&
    SELECTEDVALUE(Table2[Schedule date]) >= SELECTEDVALUE(Table1[CreatedDate]) - [relativeDays], 1,
    0
)

 

@wini_R Its not working, its filter all the date  attached screenshot

itsranga_0-1738572159074.png

 

if i select any row on the first table bottom table filter selected date to last 5 days

 

Attached Powerbi file   

 

@itsranga, I believe it works fine, there are likely some other issues in your report/data model, i.e. why would you have the interaction between visuals disabled?

wini_R_0-1738589221618.png

 

@wini_R for testing purpose i disabled then i forgot,  its works na could you please attach that pbix file

@itsranga, I just opened the file you attached earlier, didn't modify anything. Just enable the interaction back and check if it works as expected

wini_R
Solution Supplier
Solution Supplier

Hey @itsranga,

That could possibly be a difference between today's date and min date in filter context. You can check the following approach:

relativeDays = 
VAR _minDate = MIN(calTab[Date])
VAR _diff = TODAY() - _minDate
RETURN INT(_diff)+1

wini_R_0-1738348242329.png

Hope it helps!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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