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
StefanM
Helper II
Helper II

Texto en una tarjeta junto a los datos de la tabla

Hola magos de PBI! Necesito ayuda con una medida de dax.

  • Tengo una tabla de fechas que incluye una columna de meses. Por ejemplo, [Jan,Feb,Mar,Apr,etc]
  • También tengo una cortadora en la página basada en estos meses. La segmentación de datos se oculta dentro de un panel de segmentación.

Quiero tener una tarjeta en la parte inferior de la página que genere el intervalo de fechas seleccionado.

Algo así como: "primer mes" - "último mes", que generaría febrero-abril, etc.

También me gustaría que sólo salida 1 mes si sólo 1 se selecciona.

Nunca me he metido con la adición de texto de esta manera. ¿Es posible?

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@StefanM, pruebe esta medida:

Label Period Selected = 
VAR vStartDate =
    MIN ( 'Date'[Date] )
VAR vEndDate =
    MAX ( 'Date'[Date] )
VAR vYear =
    YEAR ( vEndDate )
VAR vStartMonth =
    FORMAT ( vStartDate, "mmm" )
VAR vEndMonth =
    FORMAT ( vEndDate, "mmm" )
VAR vMonthLabel =
    IF ( vStartMonth = vEndMonth, vEndMonth, vStartMonth & " - " & vEndMonth )
VAR vResult =
    vYear & " " & vMonthLabel
RETURN
    vResult

Muestre la medida en una tarjeta:

DataInsights_0-1600440730096.png





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@StefanM, pruebe esta medida:

Label Period Selected = 
VAR vStartDate =
    MIN ( 'Date'[Date] )
VAR vEndDate =
    MAX ( 'Date'[Date] )
VAR vYear =
    YEAR ( vEndDate )
VAR vStartMonth =
    FORMAT ( vStartDate, "mmm" )
VAR vEndMonth =
    FORMAT ( vEndDate, "mmm" )
VAR vMonthLabel =
    IF ( vStartMonth = vEndMonth, vEndMonth, vStartMonth & " - " & vEndMonth )
VAR vResult =
    vYear & " " & vMonthLabel
RETURN
    vResult

Muestre la medida en una tarjeta:

DataInsights_0-1600440730096.png





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

Proud to be a Super User!




Esto funciona brillantemente. La única parte que me queda por hacer es mostrar otro año para cuando el primer mes es de un año diferente, pero con su fórmula fácil de seguir, no creo que eso no será un problema ^^

Muchas gracias @DataInsights 👍

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.