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
sadwick
Frequent Visitor

Medida: cálculo de %

¡Hola a todos!
Por favor, ayúdame con el cálculo de medida de %.


Tengo datos como este:
cantidad de producto fecha lo que deseo hacer (como en Excel) - %%
2020/04/21 manzanas 30 30/900

2020/04/21 huevos 15 15/900

Harina 2020/04/21 900 900/900

2020/04/21 canela 20 20/900

Y necesito encontrar el porcentaje de todo el producto a la harina.

5 REPLIES 5
camargos88
Community Champion
Community Champion

Hola @sadwick ,

Pruebe esta medida:

Medida ?
VAR _flour - CALCULATE(SUM('Table'[amount ]); FILTRO(ALL('Tabla'); 'Tabla'[producto] - "harina"))
RETURN DIVIDE(SUM('Table'[amount ]); _flour)
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Greg_Deckler
Super User
Super User

Tal vez algo como:

Measure = 
  VAR __Amount = MAX('Table'[amount])
  VAR __Flour = MAXX(FILTER('Table',[product] = "flour"),[amount])
RETURN
  DIVIDE(__Amount,__Flour)

@ 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...

@Greg_Deckler gracias!
Pero si esta tabla es acumulativa. ¿Y necesito un porcentaje de todo el producto a la harina donde la fecha -fecha máxima?

cantidad de producto fecha lo que deseo hacer (como en Excel) - %%
2020/04/21 manzanas 30

2020/04/21 huevos 15

Harina 2020/04/21 900

2020/04/21 canela 20

2020/04/22 manzanas 60 60/400

2020/04/22 huevos 9 9/400

Harina 2020/04/22 400 900/400

2020/04/22 canela 60 60/400

Icey
Community Support
Community Support

Hola @sadwick ,

Prueba esto:

Measure =
VAR __Date =
    MAXX ( ALLSELECTED ( 'Table' ), 'Table'[date] )
VAR __Amount =
    CALCULATE (
        MAX ( 'Table'[Amount] ),
        FILTER ( ALLEXCEPT ( 'Table', 'Table'[Product] ), 'Table'[Date] = __Date )
    )
VAR __Flour =
    MAXX (
        FILTER ( ALLSELECTED ( 'Table' ), [product] = "flour" && [date] = __Date ),
        [amount]
    )
RETURN
    IF ( MAX ( 'Table'[Date] ) = __Date, DIVIDE ( __Amount, __Flour ) )

amount.PNG

Saludos

Icey

Si este post ayuda,entonces por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

OK, así que basado en esta medida rápida: https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/td-p/985814

Eso sería algo así como:

Measure = 
  VAR __Date = MAX('Table'[date])
  VAR __Product = MAX('Table'[product]) //assumes product is in the visualization
  VAR __Amount = MAXX(FILTER('Table',[product] = __Product && [date] = __Date),[amount])
  VAR __Flour = MAXX(FILTER('Table',[product] = "flour" && [date] = __Date),[amount])
RETURN
  DIVIDE(__Amount,__Flour)

@ 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...

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.