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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
andi2333
Helper I
Helper I

Error with simple DAX query

Hello, I am not sure whats going wrong here since this seems a very simple topic.

 

I have an excel table with approx 7000 entries showing log errors on a daily basis, so e.g.

 

Date | Error

01.08.2024 | Error 1

01.08.2024 | Error 2

02.08.2024 | Error 1

02.08.2024 | Error 3

etc.

 

Now I want to simply calculate how many errors I have on the last date entered in that file.

 

My query: 

VAR_LogErrorsLastDay = CALCULATE(COUNT('LogErrors'[Error),FILTER('LogErrors'MAX('LogErrors'[Date])))

However, this query only returns me the count of ALL of my entries in the excel, and not narrowed to the last date.
 
Am I missing something?
 
Thanks
1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @andi2333 -Your DAX query is almost correct, but the issue lies in how you're trying to filter the data to only count errors on the last date

 

please use the below 

VAR_LastDate = MAX('LogErrors'[Date])
VAR_LogErrorsLastDay = CALCULATE(
COUNT('LogErrors'[Error]),
'LogErrors'[Date] = VAR_LastDate
)
RETURN VAR_LogErrorsLastDay

 

Hope it works. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @andi2333 -Your DAX query is almost correct, but the issue lies in how you're trying to filter the data to only count errors on the last date

 

please use the below 

VAR_LastDate = MAX('LogErrors'[Date])
VAR_LogErrorsLastDay = CALCULATE(
COUNT('LogErrors'[Error]),
'LogErrors'[Date] = VAR_LastDate
)
RETURN VAR_LogErrorsLastDay

 

Hope it works. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.