## DAX Formula

Anything related to PowerPivot and DAX Formuale
PowerMaths
Posts: 2
Joined: Sun Oct 22, 2017 7:00 pm

### DAX Formula

Dear all,

I try to find a solution regarding my problem below:
I need to have the Max line in the "Texte" column in function of the column criteria below :

- Ste
- Compte
- Type pce
- Date (only with the max date)

The result has to be in my column "TexteMax"

I have created formulas below in columns :

•DateMax :

Code: Select all

`=MAXX(FILTER(Data;[Sté]=EARLIER([Sté]));Data[Date])`

and in column

•TexteMax :

Code: Select all

`=LOOKUPVALUE([Texte];[Date];[DateMax];[Sté];[Sté])`

But it doesn't work. As you can see below, the DateMax is wrong and i have an error in the column "TexteMax" which has to be the final result :

DAX2BIS.PNG (90.34 KiB) Viewed 504 times

MattAllington
Posts: 919
Joined: Sun May 04, 2014 4:01 pm
Location: Sydney, Australia

### Re: DAX Formula

Do you really need this in a column? How about using a measure? I answered a similar question here just yesterday https://www.mrexcel.com/forum/power-bi/ ... -date.html
Matt Allington is Professional Self Service BI Consultant, Trainer and Author of the book "Learn to Write DAX". You can hire me at http://Exceleratorbi.com.au
http://exceleratorbi.com.au/what-is-power-pivot/
http://xbi.com.au/learndax

PowerMaths
Posts: 2
Joined: Sun Oct 22, 2017 7:00 pm

### Re: DAX Formula

Dear Matt,

but when i applied your solution like below :

Code: Select all

`=CALCULATE (IF ( HASONEVALUE ( 'Data base'[Texte] );VALUES ( 'Data base'[Texte] ) );FILTER ( ALLEXCEPT ( 'Data base'; 'Data base'[Type pce]); 'Data base'[Date] = Max('Data base'[Date]);'Data base'[Compte]);'Data base'[Sté])`

It doesn't work and i get an error message on the FILTER function.

Best regards

### Who is online

Users browsing this forum: Baidu [Spider] and 5 guests