Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
We created a dashboard in Power BI Desktop to display the numeric values of various data points. The data originates in SharePoint lists and is pulled into Power BI. The issue is that there are multiple data values for each datapoint and to display the most recent data, we only want to show the last (most recent) data. The figure below is an example the page in question. It is a table visual that includes corresponding sparkline graphs. Table visuals don’t provide an option for the last record.
We found two variants of a function for displaying the last record, but we are unable to get them to work (probably not getting the syntax right).
=Last(Fields!ProductNumber.Value, "Category")
= LAST(Products[Price], Products[Category])
The question is, how can we display only the last record for each line of data in the table shown above either using the function statements or some other method?
Hi @Charles_625g ,
According to your description, you want to get a VALUE value for a recent date.
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create a calculated column
Last Record =
VAR _maxDate = MAXX(ALL('Table'),'Table'[Date])
RETURN
CALCULATE(
MAX('Table'[Value]),
FILTER(
'Table',
'Table'[Date] = _maxDate
)
)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
When I attempt to use this code in the table, I get the following error:
"A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
How can I eliminate the error? The rest of the code seems to be correct as far as syntax.
Hi @Charles_625g ,
Thank you for your reply, based on the error message you provided, there is an issue with the way you are using true/false expressions in your DAX calculations.
I modified this dax a bit and you can try if it solves your problem
Rcord =
VAR _date = MAX('Table'[Date])
RETURN
CALCULATE(
MAX('Table'[Value]),
FILTER(
'Table',
'Table'[Date] = _date
)
)
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thanks, this is helpful. This code is more in line with other examples I have been finding. Not familiar with the syntax so that is proving to be a challenge, but it gets us closer.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
103 | |
68 | |
47 | |
39 | |
37 |