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
bh_prism
New Member

Contar verdadero/falso y representar en el gráfico usando el porcentaje

Hola, chicos

Espero que alguien pueda ayudar. Tengo dos columnas en una tabla que notifica TRUE o FALSE en función de los criterios que se cumplen.

Deseo tener el recuento de VERDADERO/FALSO y representar la diferencia entre 8 VERDADERO y 2 FALSO como 80% / 20% en un gráfico visual.

¿Cómo es esto posible, he jugado con medidas y filtros, pero no puedo conseguir que funcione como lo necesito.

Gracias, Ben

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hola @bh_prism ,

Si te entiendo correctamente, pon la siguiente medida en una carta visual y obtendrás lo que quieres:

TRUE/FALSE =
VAR TRUE_ =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column1] = TRUE () )
        + CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column2] = TRUE () )
VAR FALSE_ =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column1] = FALSE () )
        + CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column2] = FALSE () )
VAR Total_ =
    COUNTROWS ( 'Table' ) * 2
VAR TRUE_Percent =
    DIVIDE ( TRUE_, Total_, BLANK () )
VAR FALSE_Percent =
    DIVIDE ( FALSE_, Total_, BLANK () )
RETURN
    TRUE_Percent & " / " & FALSE_Percent

Saludos

Icey

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

5 REPLIES 5
Icey
Community Support
Community Support

Hola @bh_prism ,

Si te entiendo correctamente, pon la siguiente medida en una carta visual y obtendrás lo que quieres:

TRUE/FALSE =
VAR TRUE_ =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column1] = TRUE () )
        + CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column2] = TRUE () )
VAR FALSE_ =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column1] = FALSE () )
        + CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column2] = FALSE () )
VAR Total_ =
    COUNTROWS ( 'Table' ) * 2
VAR TRUE_Percent =
    DIVIDE ( TRUE_, Total_, BLANK () )
VAR FALSE_Percent =
    DIVIDE ( FALSE_, Total_, BLANK () )
RETURN
    TRUE_Percent & " / " & FALSE_Percent

Saludos

Icey

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

amitchandak
Super User
Super User

@bh_prism, puede tener medidas como estas

divide(calculate(countrows(Table), table[flag]- "True"),calculate(countrows(Table))) // if boolean , table[flag]- True()
divide(calculate(countrows(Table), table[flag]- "False"),calculate(countrows(Table))) // if boolean , table[flag]- False()

tex628
Community Champion
Community Champion

¿Las columnas tienen el tipo de datos booleano true/false?


Connect on LinkedIn

Hola, sí, es de tipo de datos booleano. Gracias

tex628
Community Champion
Community Champion

Pruebe estas dos medidas:

True = 
VAR True_ = CALCULATE(COUNTROWS('Table') , 'Table'[Column1] = TRUE())
VAR Total = COUNTROWS('Table')
Return
DIVIDE(True_,total,blank())
False = 
VAR Total = COUNTROWS('Table')
VAR False_ = CALCULATE(COUNTROWS('Table') , 'Table'[Column1] = FALSE())
Return
DIVIDE(False_,Total,BLANK())


Calculan el % de una columna. Utilícelos juntos en un gráfico para obtener la distribución de esa columna.

/ J


Connect on LinkedIn

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.