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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
German_043
Frequent Visitor

IF FUNCTION

Buen día 

Estoy trabajando con la confunción IF  para cambiar la información de las graficas dependiendo si se elige un idioma u otro, pero estoy creando MEDIDAS en cada grafica para poder cambiarlas 

 

OFI_Inventario = 
VAR ValoresSelecionador = COUNT(IDIOMAS[Idioma])
VAR Seleccion = SELECTEDVALUE(IDIOMAS[Idioma])
VAR METROS = SELECTEDVALUE(Oficinas_Latam[Inventario])
VAR SQF = SELECTEDVALUE(Oficinas_Latam[Inventary sqf])
Var Formato = 
IF(
    Seleccion = "ESP",
    METROS, SQF
)
return Formato

 

Así crearia la medida para poder cambiar los datos y cada vez que quiero actualizar una nueva tabla tengo que ingresar el mismo codigo en una nueva MEDIDA pero cambiando las columnas 

 

OFI_PRECIO = 
VAR ValoresSelecionador = COUNT(IDIOMAS[Idioma])
VAR Seleccion = SELECTEDVALUE(IDIOMAS[Idioma])
VAR PESOS = SELECTEDVALUE(Oficinas_Latam[Precio])
VAR USD = SELECTEDVALUE(Oficinas_Latam[Price USD])
Var Formato = 
IF(
    Seleccion = "ESP",
    PESOS, USD
)
return Formato

 

Hay alguna manera de juntar los dos codigos? o algunas manera de anidar los IF o que regrese más de un valor al momento de la selección? 
Cuando intente anidar los IF y puse la medida en el parametro de la grafica, me decía que no puede regresar más de un valor 
Muchas gracias

1 ACCEPTED SOLUTION
Igna
Resolver III
Resolver III

Hello,

 

Not sure to understand everything but try something like this 

 

OFI_Measure = 
VAR Selection = SELECTEDVALUE(IDIOMAS[Language])

RETURN
SWITCH(
    Selection,
    "ESP", SELECTEDVALUE(Oficinas_Latam[Inventory]),
    "ENG", SELECTEDVALUE(Oficinas_Latam[Inventory sqf]),
    "ESP", SELECTEDVALUE(Oficinas_Latam[Price]),
    "ENG", SELECTEDVALUE(Oficinas_Latam[Price USD]),
    BLANK()  -- Default value if it doesn't match any language
)

 

Tell me if it helps.

 

Igna

View solution in original post

1 REPLY 1
Igna
Resolver III
Resolver III

Hello,

 

Not sure to understand everything but try something like this 

 

OFI_Measure = 
VAR Selection = SELECTEDVALUE(IDIOMAS[Language])

RETURN
SWITCH(
    Selection,
    "ESP", SELECTEDVALUE(Oficinas_Latam[Inventory]),
    "ENG", SELECTEDVALUE(Oficinas_Latam[Inventory sqf]),
    "ESP", SELECTEDVALUE(Oficinas_Latam[Price]),
    "ENG", SELECTEDVALUE(Oficinas_Latam[Price USD]),
    BLANK()  -- Default value if it doesn't match any language
)

 

Tell me if it helps.

 

Igna

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.