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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
okusai3000
Helper IV
Helper IV

Show Category for a MAX date

Hello everyone, 

 

I am trying to get the last "Aprt_estado" of the last date from this articles. On this example, for my filter of February 2020, I I woud like to see for the ESAP_COD 81029, only 28/02/20 and aprt estado= ET. That's it.  If move out the column "aprt_estado", my measure will show the correct last date (28/02) but I need that information.

 

Any advice? thanks a lot!!

 

Captura de pantalla 2020-11-04 a las 21.33.52.png

1 ACCEPTED SOLUTION
v-yuaj-msft
Community Support
Community Support

Hi @okusai3000 ,

 

Based on your description, you can do some steps as follows.

 

  1. Create a calculated index column.

 

index =

RANKX (

    FILTER ('CASE2',

'CASE2'[esca_cod]=EARLIER('CASE2'[esca_cod])),

'CASE2'[Ultimo Mov].[Date],

,DESC

)

v-yuaj-msft_0-1604972207016.png

 

  1. Create a measure.

Measure = CALCULATE(MAX('CASE2'[esca_cod]),'CASE2'[index]=1)

 

Result:

v-yuaj-msft_1-1604972207023.png

 

Best Regards,

Yuna

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuaj-msft
Community Support
Community Support

Hi @okusai3000 ,

 

Based on your description, you can do some steps as follows.

 

  1. Create a calculated index column.

 

index =

RANKX (

    FILTER ('CASE2',

'CASE2'[esca_cod]=EARLIER('CASE2'[esca_cod])),

'CASE2'[Ultimo Mov].[Date],

,DESC

)

v-yuaj-msft_0-1604972207016.png

 

  1. Create a measure.

Measure = CALCULATE(MAX('CASE2'[esca_cod]),'CASE2'[index]=1)

 

Result:

v-yuaj-msft_1-1604972207023.png

 

Best Regards,

Yuna

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@okusai3000 , add new measures like

lastnonblankvalue(table[Ultimo Mov] ,max(Table[Aprt_estado]))


lastnonblankvalue(table[Ultimo Mov] ,max(Table[Cant Equipos V2]))

hi @amitchandak ,

 

The problem is that *Ultimo Mov is not a column... is a Measure, so I cannot use it on lastnonblankvalue... any other idea?

 

thanks!

 

 

BTW, this is [ultimo mov]

 

*Ultimo Mov =
VAR CurrentDate = (max('Dim Date'[Date]))
VAR Results =
CALCULATE(LASTDATE('Fact Stock Equipos'[fecha]),
filter(all('Dim Date'),
('Dim Date'[Date] <= CurrentDate)),USERELATIONSHIP('Dim Date'[Date],'Fact Stock Equipos'[fecha]))
RETURN
Results

 

 

EDIT.

 

Ok, finally solved with a part of what @amitchandak said,

 

*aprt_estado =
VAR CurrentDate = (max('Dim Date'[Date]))

VAR Results =
CALCULATE(LASTNONBLANKVALUE('Dim Date'[Date],max('Fact Stock Equipos'[aprt_estado])),
filter(all('Dim Date'),
('Dim Date'[Date] <= CurrentDate)),all('Dim Tipos de Estado'),USERELATIONSHIP('Dim Date'[Date],'Fact Stock Equipos'[fecha]))
RETURN
Results
 
 
thanks!

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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