# Data in and date out for each client

Hey guys,
I’m trying to calculate the min date and the max date for each client. The purpose is to have a table visual where i can see the client, T Sales, Date min and date max.
My sales fact table is connected to dates and clients dimensions table.
I’ve tried calculate ( Max ( Dates[Date])) the same with min and it didn’t work.
Anyone can help?
Thanks
Pedro

MAX_Date =
VAR A = Values(Client[ID])
Return
Calculate(MAx(Date[Date]),Filter(Sales,Sales[Client ID] in A))

I guess this should answer the question for max and same way you can have a Min date too. Lemme know if this works.

Regards

Hello @Hemantsingh
It doesn’t work. Can’t even see why. It says " Can’t display the visual". Here’s my measure:

Max Date =
VAR A =
VALUES ( ‘Tab Clients’[JoinCli] )
RETURN
CALCULATE (
MAX ( Dates[Date] ),
FILTER ( ‘Tab Sales’, ‘Tab Sales’[JoinNcli] = A )
)
The field JoinCli and JoinNcli exists because i have to distinguish which client for each company and because there are clients with the same client number but different companies.

I hope you can help me
Thanks

a small Mistake in it…i updated the formula again…

Max Date =
VAR A =
VALUES ( ‘Tab Clients’[JoinCli] )
RETURN
CALCULATE (
MAX ( Dates[Date] ),
FILTER ( ‘Tab Sales’, ‘Tab Sales’[JoinNcli] in A )
)

Instead of “=A” use “in A” in the filter

1 Like

Amazing!!!
DAX is full of these “small” things…i love it and i hate it
Thank you so much @Hemantsingh