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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
manah77g
New Member

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.

1 ACCEPTED SOLUTION
v-nuoc-msft
Community Support
Community Support

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”

vnuocmsft_0-1734415228271.png

 

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
)

 

vnuocmsft_1-1734415385828.png

 

vnuocmsft_2-1734415400711.png

 

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:

 

vnuocmsft_3-1734415657110.png

 

vnuocmsft_4-1734415676832.png

 

Regards,

Nono Chen

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

4 REPLIES 4
v-nuoc-msft
Community Support
Community Support

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”

vnuocmsft_0-1734415228271.png

 

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
)

 

vnuocmsft_1-1734415385828.png

 

vnuocmsft_2-1734415400711.png

 

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:

 

vnuocmsft_3-1734415657110.png

 

vnuocmsft_4-1734415676832.png

 

Regards,

Nono Chen

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

 

manah77g
New Member

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



Hi @manah77g 
The formula is dynamic.

I don't understand what do you mean by :
"because there may be a more recent date without any data."

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Ritaf1983
Super User
Super User

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)
Ritaf1983_0-1733825948326.png

and use this flag as a filter:

Ritaf1983_1-1733826031261.png

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.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

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