Forum Discussion

cwollett's avatar
cwollett
Advocate II
1 year ago
Solved

Getting first date but adding a measure filter

Let's say I have website click data where I know the URL, date of clicks (and the week's start date by association), and number of clicks. I want to have a calculation in my data that includes the first accessed date for that website. It should look like:

 

WebsiteWeek Start DateClicksFirst Accessed Date
website.com/A7/7/2024127/7/2024
website.com/A7/14/2024247/7/2024
website.com/B7/14/2024107/14/2024

 

I have tried to use the following measure:

 

CALCULATE(
    MIN('Date Table'[Week Start Date]),
    REMOVEFILTERS('Date Table'[Week Start Date])
)

 

However, that gives me dates all the way back to the beginning of my date table:

WebsiteWeek Start DateClicksFirst Accessed Date
website.com/A6/30/2024 6/30/2024
website.com/B6/30/2024 6/30/2024
website.com/A7/7/2024126/30/2024
website.com/B7/7/2024 6/30/2024
website.com/A7/14/2024246/30/2024
website.com/B7/14/2024106/30/2024

If I try to add a filter with clicks, I get the following:

 

CALCULATE(
    MIN('Date Table'[Week Start Date]),
    REMOVEFILTERS('Date Table'[Week Start Date]),
    FILTER('Date Table', [Clicks] > 0)
)

 

WebsiteWeek Start DateClicksFirst Accessed Date
website.com/A6/30/2024 6/30/2024
website.com/B6/30/2024 6/30/2024
website.com/A7/7/2024127/7/2024
website.com/B7/7/2024 7/7/2024
website.com/A7/14/2024247/14/2024
website.com/B7/14/2024107/14/2024
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi cwollett ,

     

    Great try. I understand that you want to group by URL and return the oldest date for each URL. If that's the case, you can try:

     

    MEASURE =
    CALCULATE (
        MIN ( 'Date Table'[Week Start Date] ),
        FILTER (
            ALL ( 'Table of Website' ),
            [Website] = MAX ( 'Table of Website'[Website] )
        )
    )
    

     

    "Table of Website" is the name of the table where your Website is located.

     

     

    Best Regards,
    Stephen Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi cwollett ,

     

    Great try. I understand that you want to group by URL and return the oldest date for each URL. If that's the case, you can try:

     

    MEASURE =
    CALCULATE (
        MIN ( 'Date Table'[Week Start Date] ),
        FILTER (
            ALL ( 'Table of Website' ),
            [Website] = MAX ( 'Table of Website'[Website] )
        )
    )
    

     

    "Table of Website" is the name of the table where your Website is located.

     

     

    Best Regards,
    Stephen Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly