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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

date_passed_to_condition_column_from_dateslicer

Hi,

 

Please i want to pass date from date slicer("type - before date") to conditional column.

I have 2 tables:

'DataTable'

'CalendarTable'

 

Slicer is configured to column 'CalendarTable'[date]

 

 

conditional column =

var [to_date] = calculate(  max('CalendarTable'[date]),  all('CalendarTable'[date])  )

return

if(

'DataTable'[date] <= [to_date]

,1

,0

)

 

I cannot pass the right date to [to_date] variable .. it ignores the date slicer value.

 

Thank you for any help.

2 ACCEPTED SOLUTIONS
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

First you should know that column would not affect by the slicer changed so if you want to do that, you need to create a measure instead of a column:

conditional measure =
VAR to_date =
    CALCULATE ( MAX ( 'Calendar Table'[Date] ), ALLSELECTED ( 'Calendar Table' ) )
RETURN
    IF ( MAX ( 'DataTable'[date] ) <= to_date, 1, 0 )

date.png

 

Best Regards,
Community Support Team _ Yingjie Li
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

Hi @Anonymous ,

If you want to filter the date by the slicer in the table visual, just put the previous measure in the table visual filter and set its value as 1:

visual filter.png

 

Best Regards,
Community Support Team _ Yingjie Li
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

5 REPLIES 5
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

First you should know that column would not affect by the slicer changed so if you want to do that, you need to create a measure instead of a column:

conditional measure =
VAR to_date =
    CALCULATE ( MAX ( 'Calendar Table'[Date] ), ALLSELECTED ( 'Calendar Table' ) )
RETURN
    IF ( MAX ( 'DataTable'[date] ) <= to_date, 1, 0 )

date.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you ! this is awesome !

 

Now, if i want to filter dates by that conditional measure (filter with 2 states .. 1 and 0 .. selected value filters dates accordingly) .. is that possible ? 

Ive tried to create 2 columns that references that measure - doesnt work.

 

1,

conditional column = conditional measure

2,

conditional column = if(conditional measure = 1, 1, 0)

 

Would you create column for filtering ? .. or would you somehow use that measure ? .. or anything else ? 

Hi @Anonymous ,

If you want to filter the date by the slicer in the table visual, just put the previous measure in the table visual filter and set its value as 1:

visual filter.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous ,

Try like

conditional column =

var to_date = max('CalendarTable'[date])

return

if(

'DataTable'[date] <= to_date

,1

,0

)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Radek777_0-1623077526058.png

Ive tried your solution.. it does not work .. variable still ignores date slicer filtering

(returned value should be 26.4.2021)

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.