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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
tatac1412
Helper I
Helper I

Encontrar la fecha mínima entre varias columnas

Holaaa, necesito ayuda en sacar la fecha min entre 4 columnas. El ejemplo sería:

primera fecha        segundafecha   tercera fecha   cuartafecha

2018/03/05            2015/05/20       2011/04/05     2021/02/15

 

El resultado entre la cuatro columnas debe de arrojar 2011/04/05, 

Agradezco la ayuda.

Gracias

2 ACCEPTED SOLUTIONS
v-yanjiang-msft
Community Support
Community Support

Hi @tatac1412 ,

According to your description, I create a sample.

vkalyjmsft_0-1659423991449.png

Here's my solution, create a measure.

Min =
VAR _T =
    UNION (
        VALUES ( 'Table'[Column1] ),
        VALUES ( 'Table'[Column2] ),
        VALUES ( 'Table'[Column3] ),
        VALUES ( 'Table'[Column4] )
    )
RETURN
    MINX ( _T, [Column1] )

Get the correct result.

vkalyjmsft_1-1659424065709.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

Hi @tatac1412 ,

Do you mean if there is a column has blank value like this:

vkalyjmsft_0-1661478645053.png

By my test it does not affect the final result, it still get the min value in this scenario.

vkalyjmsft_1-1661478751147.png

Best Regards,
Community Support Team _ kalyj

View solution in original post

6 REPLIES 6
v-yanjiang-msft
Community Support
Community Support

Hi @tatac1412 ,

According to your description, I create a sample.

vkalyjmsft_0-1659423991449.png

Here's my solution, create a measure.

Min =
VAR _T =
    UNION (
        VALUES ( 'Table'[Column1] ),
        VALUES ( 'Table'[Column2] ),
        VALUES ( 'Table'[Column3] ),
        VALUES ( 'Table'[Column4] )
    )
RETURN
    MINX ( _T, [Column1] )

Get the correct result.

vkalyjmsft_1-1659424065709.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

Muchas gracias por la solución, me puedes indicar también es esa medida como hago para que si en alguna de esas columnas esta vacia no tome ese campo como menor fecha??

 

Min =
VAR _T =
    UNION (
        VALUES ( 'Table'[Column1] ),
        VALUES ( 'Table'[Column2] ),
        VALUES ( 'Table'[Column3] ),
        VALUES ( 'Table'[Column4] )
    )
RETURN
    MINX ( _T, [Column1] )

porque tengo campos vacios y la formula los arroja como fecha menor.

 

Gracias

Hi @tatac1412 ,

Do you mean if there is a column has blank value like this:

vkalyjmsft_0-1661478645053.png

By my test it does not affect the final result, it still get the min value in this scenario.

vkalyjmsft_1-1661478751147.png

Best Regards,
Community Support Team _ kalyj

Muchas gracias por la solución, te pregunto si en una de esas 4 columnas de fechas hay por ejemplo 1800/01/01 como fecha comodín como hago para que la función no la tome como fecha minima sino que coja otra fecha ; ejemplo colum 1(2001/08/05)   colum2( 2011/04/17)  colum3(1800/01/01 ) colum4(2022/05/09)

el resultado será 2001/08/05. Agradezco la ayuda. gracias

amitchandak
Super User
Super User

@tatac1412 , Try

Minx({[Col1],[Col2],[Col3],[Col4]}, [Value])

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors