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 encontrar un recuento distinto de la columna 1 donde, al agrupar por columna 1, los valores de la columna 2 se pueden encontrar en dos listas.
Lista 1 = {1, 2}
Lista 2 = {X, Y}
A | 4 |
A | 2 |
A | X |
B | 3 |
B | Z |
C | 1 |
C | Y |
C | Q |
D | 2 |
D | X |
Aquí el recuento esperado sería 3, porque:
Donde Columna 1 = A, la Columna 2 contiene valores {4, 2, X}. Como 2 está en {1, 2} y X está en {X, Y}, se cumplen los criterios
Donde Columna 1 = C, Columna 2 contiene valores {1, Y, Q}. Como 1 está en {1, 2} e Y está en {X, Y}, se cumplen los criterios
Donde Columna 1 = D, Columna 2 contiene valores {2, X}. Como 2 está en {1, 2} y X está en {X, Y}, se cumplen los criterios
No estoy seguro de cómo crear una medida en Power BI que logre esto. ¡Cualquier ayuda sería muy apreciada!
Hola
¿Por qué tendría que ser una medida?
Esta es una versión de Power Query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJRitWBsIzgrAgwywnIMoazosAsZyDLEM6KhLMCwSwXuCkuEFNiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Test", each List.Contains({"1","2"},[Column2]) or List.Contains({"X","Y"},[Column2])),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Test] = true)),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Column1"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Other Columns")
in
#"Removed Duplicates"
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 |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 |