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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Agregar columna basada en la búsqueda en la misma tabla

Hola

Estoy tratando de entender cómo puedo crear una columna con una búsqueda en la misma tabla usando una expresión DAX

En Excel se vería así, estoy buscando hacer coincidir los registros de la fecha del último mes con alookup en la columna 'Fecha'

vszah_0-1597354633263.png

En DAX estoy probando esto

valor del último mes: LOOKUPVALUE(table[Records],table[Date],table[Last Month Date].[ Fecha])
Pero obtengo el error "Se proporcionó una tabla de varios valores donde se esperaba un solo valor."
¿Qué estoy haciendo mal?
muchas gracias por su ayuda

1 ACCEPTED SOLUTION

Hola @vszah ,

Crear una columna calculada

Column = LOOKUPVALUE(Table5[Records],Table5[Date],Table5[Last Month Date])

1.jpg

saludos
Harsh Nathani
¿He respondido a tu pregunta? ¡Marca mi puesto como una solución! Apreciar con un Kudos!! (Haga clic en el botón Pulgares arriba)

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@vszah , para una columna se puede probar como

sumx(filter(table,[date] á earlier([last month Date])),[record])
sumx(filter(table,[date] á earlier([last month Date])),earlier([record]))

O

sumx(filter(table,month([date]) á month(earlier([last month Date]))),[record])
sumx(filter(table,month([date]) á month(earlier([last month Date]))),earlier([record]))

¿Puede compartir datos de ejemplo y salida de ejemplo en formato de tabla?

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I tried
recors last month = sumx(filter(table),table[Date] = EARLIER(table[Last Month Date].[Date]),table[records]
)
 
but get this message "few arguments were passed to the FILTER function. The minimum argument count for the function is 2."
Anonymous
Not applicable

I added some sample data here :https://we.tl/t-FjCIeSQH5R

Hola @vszah ,

Crear una columna calculada

Column = LOOKUPVALUE(Table5[Records],Table5[Date],Table5[Last Month Date])

1.jpg

saludos
Harsh Nathani
¿He respondido a tu pregunta? ¡Marca mi puesto como una solución! Apreciar con un Kudos!! (Haga clic en el botón Pulgares arriba)

pranit828
Community Champion
Community Champion

Hola @vszah

VAR SearchValue = <Search_Value>
RETURN
    CALCULATE (
        SELECTEDVALUE ( <Result_ColumnName>, <Alternate_Result> ),
        FILTER (
            ALLNOBLANKROW ( <Search_ColumnName> ),
            <Search_ColumnName> == SearchValue     -- The == operator distinguishes between blank and 0/empty string
        ),
        ALL ( <table_of_Result_ColumnName> )       -- If Result_ColumnName is t, this is ALL ( t )
    )

¿Resolví tu problema? ¡Marca mi puesto como una solución! Apreciamos sus Felicitaciones, Pulse el botón pulgar hacia arriba!!!

saludos
Pranit





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Solution Authors