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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
telston
New Member

DAX to find current project status

I have a table of different tasks and their scheduled start and end dates.  How would I figure out which task is closest to the current date and then display that task in a seperate column in my table.  So for example, for this screenshot, I would want the "current status" to be "Design - 0.9" since that task starts 2/9/2024 and is the closest to today's date and has not ended yet.  I have already created a field that concatenates the Phase and Design Status but am stuck on how to look up the date range and return what I need.  Thanks for any help!!

 

telston_0-1707856079283.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @telston ,

 

According to the error message, DAX cannot compare the value of Date type with the value of Text, you can check whether [start date] is in Text format.

You can check whether [start date] is in text format. You can change it to the correct date format in Power Query - Transform.

vyangliumsft_0-1708672293617.png

Or in Power BI Desktop - Column Tools

vyangliumsft_1-1708672293618.png

 

 

Best Regards,

Liu Yang

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

3 REPLIES 3
Anonymous
Not applicable

Hi  @telston ,

 

According to the error message, DAX cannot compare the value of Date type with the value of Text, you can check whether [start date] is in Text format.

You can check whether [start date] is in text format. You can change it to the correct date format in Power Query - Transform.

vyangliumsft_0-1708672293617.png

Or in Power BI Desktop - Column Tools

vyangliumsft_1-1708672293618.png

 

 

Best Regards,

Liu Yang

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

telston
New Member

I'm getting an error The data couldn't be loaded for the visual because the DAX couldn't compare values of type Date and values of tyler Text.  I tried filtering the table I included above and got the same thing.   I can't figure out why I am getting that error when the dates are all in Date format.

 

My ultimate goal is to return the most current status into another table with the project name and other project info.  

Anonymous
Not applicable

Hi  @telston ,

 

Here are the steps you can follow:

1. Create measure.

Flag =
var _today=TODAY()
var _maxdate=
MAXX(
    FILTER(ALL('Table'),
    'Table'[Start Date]<_today),[Start Date])
return
IF(
    MAX('Table'[Start Date])=_maxdate&&MAX('Table'[End Date])>_today,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1707875800745.png

3. Result:

vyangliumsft_1-1707875800747.png

 

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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