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
Anonymous
Not applicable

Dax obtiene el valor de la fila más antigua de un grupo

Hola a todos.

Tengo una tabla con débitos, créditos y otras columnas... algunos de ellos son la columna con cuentas contables, saldo inicial y fecha del saldo inicial.

Las cuentas contables se repiten en varias materias primas, repitiendo el saldo inicial, por lo que necesito una medida que me dé el primer saldo inicial (ordenado por la fecha de saldo inicial) de cada cuenta contable.

Por ejemplo:

Saldo inicial de la fecha de la cuenta

2 21/01/2020 $2

2 22/01/2020 $20

3 01/01/2019 $0

3 02/01/2019 $10

Resultado:

Saldo inicial de la fecha de la cuenta

2 21/01/2020 $2

3 01/01/2019 $0

Por favor, si alguien tiene una idea, estaré muy agradecido.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@eduardosilvin - Esto parece Lookup Min/Max - https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434

En su caso, puede usar MIN o "first" para obtener su Fecha en su visualización. Para el saldo inicial:

Initial Balance Measure = 
  VAR __Account = MAX([Account])
  VAR __MinDate = MINX(FILTER('Table',[Account] = __Account),[date])
RETURN
  MINX(FILTER('Table',[Account] = __Account && [date] = __date),[initial balance])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@eduardosilvin - Esto parece Lookup Min/Max - https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434

En su caso, puede usar MIN o "first" para obtener su Fecha en su visualización. Para el saldo inicial:

Initial Balance Measure = 
  VAR __Account = MAX([Account])
  VAR __MinDate = MINX(FILTER('Table',[Account] = __Account),[date])
RETURN
  MINX(FILTER('Table',[Account] = __Account && [date] = __date),[initial balance])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler works perfectly, thank you sooooo much!!!!

@eduardosilvin - Lo siento que se suponía que era:

Initial Balance Measure = 
  VAR __Account = MAX([Account])
  VAR __MinDate = MINX(FILTER('Table',[Account] = __Account),[date])
RETURN
  MINX(FILTER('Table',[Account] = __Account && [date] = __MinDate),[initial balance])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@eduardosilvin ,

Crear una medida como esta

firstnonblankvalue(Table[date],sum(Table[initial balance]))

Y usar con Account y min(Table[date]) o First Table[date] en un objeto visual

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.