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

Utilice una medida diferente dependiendo de la segmentación

Hola, chicos

Quiero crear una medida que haga lo siguiente:

Foto Power BI inglés.png

Si el año en la segmentación de datos es el mismo que en el gráfico, aplique la medida Pronóstico y si el año en el gráfico es anterior al de la segmentación de datos aplicar la medida NotYTDSales con una sola medida, ¿es posible?, ¿cómo puedo hacerlo?

Gracias de antemano.

1 ACCEPTED SOLUTION

No @PwrBI01 ,

Por favor, intente así:

Measure = 
var sel = SELECTEDVALUE('Date'[Year])
return
IF(YEAR(MAX('Table'[Date])) = sel,[1],[2])

v-xuding-msft_0-1601972487668.png

Best Regards,
Xue Ding
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

4 REPLIES 4
amitchandak
Super User
Super User

@PwrBI01 , Usted puede probar una fórmula como

if(max(Date[Year]) á selectedvalue(Date[Year]), [previsión], [real])

Ejemplo

if(max(Date[Year]) á selectedvalue(Date[Year]), [Measure1], [Measure2])

@amitchandak funciona correctamente para 2018 pero no para 2019

No @PwrBI01 ,

Por favor, intente así:

Measure = 
var sel = SELECTEDVALUE('Date'[Year])
return
IF(YEAR(MAX('Table'[Date])) = sel,[1],[2])

v-xuding-msft_0-1601972487668.png

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

Hola @v-xuding-msft,

Gracias por su respuesta,

He intentado la forma en que dices y funciona. Pero he notado que tengo otro problema porque el valor de la medida 'Pronóstico' no está funcionando correctamente en 2019 y no sé por qué. Tengo crear 2 objetivos y sólo uno funciona.

https://drive.google.com/file/d/16kdd9O7bB8hGlIFtQKRuXqpRptYNr9ov/view?usp=sharing

Gracias de antemano.

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.