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.
Estoy buscando la forma de crear la tercera columna "Resumen" para saber si los países producen ambos tipos, (si detecta que por ejemplo colombia tiene hierro y cobre) o si sólo detecta uno, el nombre del elemento que usa.
Dejo el ejemplo abajo
Pais | Tipo de elemento | Resumen |
Colombia | Hierro | Ambos |
Grecia | Hierro | Hierro |
Costa Rica | Cobre | Cobre |
Colombia | Cobre | Ambos |
Grecia | Hierro | Hierro |
Argentina | Cobre | Cobre |
He visto ejemplos parecidos pero no logro hacerlo de esa manera.
¿Me ayudan?
Solved! Go to Solution.
Hi @Luisevar12 ,
Try this code to create [Resumen] column in your table.
Resumen =
VAR _cnt =
CALCULATE (
DISTINCTCOUNT ( 'Tabla'[Tipo de elemento] ),
ALLEXCEPT ( 'Tabla', Tabla[Pais] )
)
RETURN
IF ( _cnt = 2, "Ambos", Tabla[Tipo de elemento] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Luisevar12 ,
Try this code to create [Resumen] column in your table.
Resumen =
VAR _cnt =
CALCULATE (
DISTINCTCOUNT ( 'Tabla'[Tipo de elemento] ),
ALLEXCEPT ( 'Tabla', Tabla[Pais] )
)
RETURN
IF ( _cnt = 2, "Ambos", Tabla[Tipo de elemento] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Luisevar12 , Try like
new column =
var _cnt = calculate(distinctCOUNT(Table[Tipo de elemento]),filter(Table, Table[Pais] = max(Table[Pais]) && Table[Pais] in{"Hierro", "Cobre"} ))
return
if(_cnt =2, "Both", [Pais])
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 |
---|---|
96 | |
95 | |
80 | |
74 | |
66 |
User | Count |
---|---|
130 | |
106 | |
105 | |
86 | |
72 |