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
raymond
Post Patron
Post Patron

Calcular el número de días hasta que un valor se duplique

Hola comunidad,

puede onyone ayudarme a calcular el número de días hasta que un valor se duplique? No conseguimos encontrar tu ubicación exacta. ¿Alguien tiene algo a mano?

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

Hola, @raymond

Basándome en mi investigación, puede crear una medida como se muestra a continuación.

CountDays = 
var _maxdate = 
CALCULATE(
    MAX('Table'[Date]),
    ALLSELECTED('Table')
)

var _maxvalue = 
LOOKUPVALUE(
    'Table'[Value],
    'Table'[Date],
    _maxdate
)

var _halfvaluedate = 
LOOKUPVALUE(
    'Table'[Date],
    'Table'[Value],
    CALCULATE(
        MAX('Table'[Value]),
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Value]<=_maxvalue/2
        )
    )
)

return
DATEDIFF(
    _halfvaluedate,
    _maxdate,
    DAY
)+1

Resultado:

d1.png

Saludos

Allan

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.

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hola, @raymond

Basándome en mi investigación, puede crear una medida como se muestra a continuación.

CountDays = 
var _maxdate = 
CALCULATE(
    MAX('Table'[Date]),
    ALLSELECTED('Table')
)

var _maxvalue = 
LOOKUPVALUE(
    'Table'[Value],
    'Table'[Date],
    _maxdate
)

var _halfvaluedate = 
LOOKUPVALUE(
    'Table'[Date],
    'Table'[Value],
    CALCULATE(
        MAX('Table'[Value]),
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Value]<=_maxvalue/2
        )
    )
)

return
DATEDIFF(
    _halfvaluedate,
    _maxdate,
    DAY
)+1

Resultado:

d1.png

Saludos

Allan

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.

amitchandak
Super User
Super User

La información que ha proporcionado no me está aclarando el problema. Por favor, explíquelo con un ejemplo.

Aprecia tus Felicitaciones.

Debería funcionar un poco así. Dependiendo de la selección de fecha que se realice, la medida debe calcular el número de días que se encuentran entre el valor más grande (aquí acumulado) y la mitad del valor.

2020-04-01 09_11_43-Mappe1 - Excel.png2020-04-01 09_11_59-Mappe1 - Excel.png2020-04-01 09_12_09-Mappe1 - Excel.png

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.