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
Anonymous
Not applicable

Getting a single column value based on another (unique) column value - Optimize

Hi all,

 

I'm trying to get a single column value from a table based on another (unique) column value. I've managed to get the value, but I have the feeling it's too clunky and could be made way simpler. Since my objective is not just to get something to work, but also to learn as much about DAX as I can, I figured I'd ask the community for help. 

 

In a nutshell; I'm looking for a value in a (calculated) column in a date table. I need the value for Today. This seems to work, but feels too complex to just return a single value. Any advice would be appreciated. Thanks!

 

 

 

VAR endDate = CALCULATE( MAX(  'date'[dashboard_endDate]  ),  'date'[date]  = TODAY() )

 

 

2 REPLIES 2
Anonymous
Not applicable

Thanks for the reply, @amitchandak

 

The statement works indeed as expected. I'm just looking to see if I can optimize it. I find it weird I have to use a calculate' and 'MAX' (or maxx), if I just want to return a single value from a table where I know I'm not looking at a range of data but just a single row.

 

Sample data is very basic. It looks something like this. I just want to get the corresponding 'dashboard_endDate' for the current date so that I can automatically update data in my dashboard. (I can't use a relative date slicer for example, because information of the previous month can only be shown 'x' working days after the new month starts).

 

Datedashboard_endDate
2021-06-012021-04-30
2021-06-022021-04-30
2021-06-032021-04-30
2021-06-042021-05-31
2021-06-052021-05-31
2021-06-062021-05-31

 

This might just be the way PowerBI/DAX works and I'm overthinking things. If that's the case, I'll stop looking for another solution. 

amitchandak
Super User
Super User

@Anonymous , I think this is correct. Other way can be

maxx(filter('Date', 'Date'[Date] = Today()), 'Date'[Dashboard_endDate])

 

or

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.