Skip to main content

Notifications

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?

  • Brian Stubelt Profile Picture
    Brian Stubelt 2 on at
    RE: Specify Dynamic Filter in Measure

    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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans