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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
melihcinar
Regular Visitor

Fetching first date and last date for the same values in a column

Hi,

 

I am trying to create two columns as checking company names (in the below example, it's in A column) and I need to fetch the first date (in B column) and the last date (in B column) for the same company names.

 

I shared a sample data below and the two colored columns should be the results.

 

melihcinar_0-1629574694957.png

 

I need dax formula for it and any help or directions appreciated

 

Thanks...

 

 

 

 

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can use a column or measure expression like this

 

FirstDate = CALCULATE(MIN(Table[Date]), ALLEXCEPT(Table, Table[Company Name]))

 

LastDate = CALCULATE(MAX(Table[Date]), ALLEXCEPT(Table, Table[Company Name]))

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

hello


I just have the same problem but I put the formula and it tells me that it is wrong.

"You can't determine a single value for the 'FECHA_VIS_COMPLETA' column in the '3 EV_total views' table. This can happen when a measurement formula references a column that contains many values without specifying an aggregation, such as min, max, count, or sum, for or "

Can you help me?

I have a table with hash_id (as if it were the name of the company) and in my case date of viewing videos, several per customer (as if they were purchase dates), and I need to know the first date by hash_id.

Syndicate_Admin
Administrator
Administrator

Thank you very much for your contribution

melihcinar
Regular Visitor

Hi,

 

Thanks for the reply. That was I was looking for.

 

Have a nice day

mahoneypat
Microsoft Employee
Microsoft Employee

You can use a column or measure expression like this

 

FirstDate = CALCULATE(MIN(Table[Date]), ALLEXCEPT(Table, Table[Company Name]))

 

LastDate = CALCULATE(MAX(Table[Date]), ALLEXCEPT(Table, Table[Company Name]))

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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