Forum Discussion

manah77g's avatar
manah77g
Regular Visitor
1 year ago
Solved

Latest date filter

Dear Experts, 

I have created a dashboard related to the population, and it updates daily. Now, I want to create a filter using the Page Filter available in the Filters pane so that it filters based on the latest date available in the table. I kindly request your assistance in finding a solution to this issue.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi manah77g 

     

    Thank you very much Ritaf1983 for your prompt reply.

     

    Is your problem solved? If not, here are some solutions I can provide:

     

    Here's some dummy data

     

    “Table”

     

    If you want to implement page-level filtering, try:

     

    Create a column.

     

    Latest date = 
    var _maxDate = CALCULATE(MAX('Table'[Date]), ALL('Table'))
    RETURN
    IF(
        'Table'[Date] = _maxDate,
        1,
        0
    )

     

     

     

    If you want to implement visual-level filtering, try:

     

    Create a measure.

     

    Measure Latest date = 
    var _maxDate = CALCULATE(MAX('Table'[Date]), ALL('Table'))
    RETURN
    IF(
        SELECTEDVALUE('Table'[Date]) = _maxDate,
        1,
        0
    )

     

    Click the visual you want to filter:

     

     

     

    Regards,

    Nono Chen

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

     

4 Replies

  • Hi manah77g 
    You can create flag column in your date table like :

    max_date_check = if([Date]<= MAXX(RELATEDTABLE(orders),'orders'[Order Date]),1,0)

    and use this flag as a filter:

    The pbix with the example is attached

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

  • manah77g's avatar
    manah77g
    Regular Visitor

    Thank you Ritaf1983 ,

    I want you to modify the code to work with the latest date that contains population data, or according to the example you provided, because there may be a more recent date without any data.

    Also, is the measure you created dynamic? Meaning, does it automatically change when a new date with updated population data is found?

    Ritaf1983 I look forward to your next assistance


    Thank you for your help, I truly appreciate your assistance



  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi manah77g 

     

    Thank you very much Ritaf1983 for your prompt reply.

     

    Is your problem solved? If not, here are some solutions I can provide:

     

    Here's some dummy data

     

    “Table”

     

    If you want to implement page-level filtering, try:

     

    Create a column.

     

    Latest date = 
    var _maxDate = CALCULATE(MAX('Table'[Date]), ALL('Table'))
    RETURN
    IF(
        'Table'[Date] = _maxDate,
        1,
        0
    )

     

     

     

    If you want to implement visual-level filtering, try:

     

    Create a measure.

     

    Measure Latest date = 
    var _maxDate = CALCULATE(MAX('Table'[Date]), ALL('Table'))
    RETURN
    IF(
        SELECTEDVALUE('Table'[Date]) = _maxDate,
        1,
        0
    )

     

    Click the visual you want to filter:

     

     

     

    Regards,

    Nono Chen

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