Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

¿Cómo debo usar la función SWitch para mis dos orígenes de datos?

Tengo dos fuentes de datos, mi problema es que la declaración If no está funcionando en mi medida.

Lo que necesito: Quiero usar el Dato A si el Año es el Año Actual, si no usaré el Dato B.

Por favor, ayuda.

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

@fssebastian , Suponiendo que sean tablas. Necesita una tabla común de fecha / año, luego puede crear una medida como

if(year(max('Date'[Date]) = Year(Today) , sum(TableA[Value]) , sum(TableB[Value]) )

Necesita usar año/fecha en la tabla Visual from Date/Year

si es necesario

sumx(Valores('Fecha'[año]) , if(año(max('Fecha'[Fecha]) = Año(Hoy) , suma(TablaA[Valor]) , suma(TablaB[Valor]) ) )

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

@fssebastian , Suponiendo que sean tablas. Necesita una tabla común de fecha / año, luego puede crear una medida como

if(year(max('Date'[Date]) = Year(Today) , sum(TableA[Value]) , sum(TableB[Value]) )

Necesita usar año/fecha en la tabla Visual from Date/Year

si es necesario

sumx(Valores('Fecha'[año]) , if(año(max('Fecha'[Fecha]) = Año(Hoy) , suma(TablaA[Valor]) , suma(TablaB[Valor]) ) )

Gracias, mi mente se quedó en blanco por un minuto. Esto ayuda. ¡Gracias!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors