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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.