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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
tatac1412
Helper I
Helper I

Ayuda en error La expresión hace referencia a varias columnas. No se pueden convertir varias columna

 Buenos días,
 
Me ayudan por favor con esta médida me sale el error "La expresión hace referencia a varias columnas. No se pueden convertir varias columnas a un valor escalar" porfa me ayudas Gracias
 
ProporHemoSev<18 =
Var var31=filter('EHC','EHC'[V31EsquemaTratamientoActual] IN {"1","2","4"})
Var Numerador1 = if( NOT ISEMPTY (var31), countx('EHC', var31),"")
var Numerador = if( NOT ISEMPTY (var31),count('EHC'[AñoCorte]) - Numerador1,"")
var denominador= count('EHC'[AñoCorte])
Var ProporHemosev =  if( NOT ISEMPTY (var31),divide( Numerador,denominador*100),"")
return ProporHemosev
1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @tatac1412 ,

 

You should modified this code: countx('EHC', var31)

Both EHC and var31 are tables, thus you can't make this measure work.

Based on your description, I have created a simple sample:

vjianbolimsft_0-1672714374390.png

Please try something like this:

 

ProporHemoSev<18 = 
Var var31=filter('EHC','EHC'[V31EsquemaTratamientoActual] IN {"1","2","4"})
Var Numerador1 = if( NOT ISEMPTY (var31), COUNTROWS(var31))
var Numerador = if( NOT ISEMPTY (var31),count('EHC'[AñoCorte]) - Numerador1)
var denominador= count('EHC'[AñoCorte])
Var ProporHemosev =  if( NOT ISEMPTY (var31),divide( Numerador,denominador*100))
return ProporHemosev

 

Final output:

vjianbolimsft_1-1672714394672.png

 

Best Regards,

Jianbo Li

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

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @tatac1412 ,

 

You should modified this code: countx('EHC', var31)

Both EHC and var31 are tables, thus you can't make this measure work.

Based on your description, I have created a simple sample:

vjianbolimsft_0-1672714374390.png

Please try something like this:

 

ProporHemoSev<18 = 
Var var31=filter('EHC','EHC'[V31EsquemaTratamientoActual] IN {"1","2","4"})
Var Numerador1 = if( NOT ISEMPTY (var31), COUNTROWS(var31))
var Numerador = if( NOT ISEMPTY (var31),count('EHC'[AñoCorte]) - Numerador1)
var denominador= count('EHC'[AñoCorte])
Var ProporHemosev =  if( NOT ISEMPTY (var31),divide( Numerador,denominador*100))
return ProporHemosev

 

Final output:

vjianbolimsft_1-1672714394672.png

 

Best Regards,

Jianbo Li

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

lbendlin
Super User
Super User

Try this version

 

 

ProporHemoSev<18 =
Var var31=filter('EHC','EHC'[V31EsquemaTratamientoActual] IN {"1","2","4"})
Var Numerador1 = if( NOT ISEMPTY (var31), countx('EHC', var31))
var denominador= count('EHC'[AñoCorte])
var Numerador = if( NOT ISEMPTY (var31),denominador - Numerador1)
return  if( NOT ISEMPTY (var31),divide( Numerador,denominador*100,0))

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors