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.
Hola a todos
Necesito ayuda con la siguiente pregunta:
Tengo los siguientes datos
Nombre | status1 | status2 |
A | 1 | 0 |
A | 0 | 1 |
B | 0 | 0 |
B | 0 | 0 |
B | 1 | 0 |
C | 0 | 1 |
C | 0 | 0 |
Necesito escribir una consulta DAX donde debería contar tales filas cuyo estado1 - 1 y status2 nunca fue 1
En el ejemplo anterior, debemos contar como 1.
porque B es la única entrada para la que status1- 1 y status2 nunca llegó a ser 1.
No puedo crear una tabla ya que necesito llevar a cabo esta operación en un conjunto de datos en tiempo real.
Gracias
Vaibhav
Hola, @vmishra1
Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.
Mesa:
Puede crear una medida como se indica a continuación.
Count =
var tab =
ADDCOLUMNS(
'Table',
"Flag",
var _name = [Name]
var _sts1 = [status1]
var _sts2 = [status2]
return
IF(
[status1]=1&&
COUNTROWS(
FILTER(
ALL('Table'),
'Table'[Name]=_name&&
'Table'[status2]=1
)
)=BLANK()
,
1,0
)
)
return
COUNTROWS(
FILTER(
tab,
[Flag]=1
)
)
Resultado:
Saludos
Allan
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
@vmishra1 puede agregar la siguiente columna y luego sumar en esta columna para obtener el recuento
Col =
VAR __totalRowsStatus2 = CALCULATE ( SUM ( 'status'[status2] ), ALLEXCEPT ( 'status', 'status'[Name] ) )
RETURN
IF ( 'status'[status1] = 1 && __totalRowsStatus2 = 0, 1 , 0 )
Me gustaría❤ elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!
⚡Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionados con Power BI.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k : Gracias por su mensaje.
Necesitamos contar la fila solo cuando status1 - 1 y status2 <> 1 en todas las entradas como filas.
@vmishra1 no está seguro, la solución que publiqué se basa en su publicación original, ¿lo probó? No estoy seguro de cuál es tu última respuesta.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k : lo siento, pero no tengo la opción de agregar una columna a la tabla de datos. ¿Se puede llevar a cabo en la mesa temporal?
Por favor, guíame ya que soy bastante nuevo en este mundo.
tal vez probar esta medida
Measure = CALCULATE(COUNTROWS('Table (3)'),FILTER('Table (3)','Table (3)'[status1]=1&&'Table (3)'[status2]<>1))
Sin embargo, me pregunto por qué no contaste la primera fila. porque que A es 1 para el estado 1 y 0 para el estado 2 también.
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |