web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Specify Dynamic Filter in Measure

(0) ShareShare
ReportReport
Posted on by 8

Hello:  I have Two segments that I need to create.
1-Last Appointment Date

2-Next Appointment Date

There's an Appointment Entity that has a field, ApptDate - the logic for the first one is MAX(APPTDATE) where ApptDate < Today  . And for next, it's MIN(APPTDATE) where AppDate > Today

Creating the measure itself isn't a problem, but the second condition is where i'm having a problem. I can use the Filter to  specify the condition but it looks like I can only do it with effectively a hard coded date.  Is there any way to accomplish this with a built-in field or token that would evaluate to Today, whenever it's run?

I have the same question (0)
  • Brian Stubelt Profile Picture
    2 on at

    As far as I'm aware I don't know of any dynamic filters, but if someone else does I'd love to learn. My only thought which is a bit convoluted would be to create a new data source and create a date table that has a column that compares if the date is today and mark it as 'Today'. Then create a measure of like First date that equals 'Today' in that column (there should only be one). THEN use that measure output to compare in another measure. You can just have that date table refresh automatically at midnight every day and the IsToday column should update.

    I took a stab at the power query for the date table. You shouldn't even need to bring it through M3 to use it in a measure.

    let

     Source = List.Dates(#date(2022,01,01), 365*7, #duration(1,0,0,0)),

     #"Converted to table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),

     #"Changed column type" = Table.TransformColumnTypes(#"Converted to table", {{"Column1", type date}}),

     #"Renamed columns" = Table.RenameColumns(#"Changed column type", {{"Column1", "Date"}}),

     #"Added custom" = Table.TransformColumnTypes(Table.AddColumn(#"Renamed columns", "IsToday", each if [Date] = Date.From(DateTime.LocalNow()) then "Today" else "No"), {{"IsToday", type text}}),

     #"Changed column type 1" = Table.TransformColumnTypes(#"Added custom", {{"Date", type datetime}})

    in

     #"Changed column type 1"

    Hopefully that makes some sense. Like I said, a bit convoluted, but I think it could work.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 146 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 59

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans