Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hola.
Parece que no puedo encontrar una respuesta, una pregunta simple, ¿cómo mostraría la clasificación de la categoría durante un período seleccionado?
Ahora mismo, para el ejercicio lo tengo de la siguiente manera:
Ranking Fruits = RANKX(ALL(Master[FruitName]),[Suma valor],,DESC,Denso)
Rango | Nombre de la fruta | Valor de suma |
1 | Manzana | 500 |
2 | Pera | 439 |
3 | Plátano | 350 |
4 | Naranjas | 299 |
5 | Kiwi | 100 |
Quiero poder mostrar el ranking en matriz con ranking en 1ª columna, el periodo de tiempo como columna y para cada periodo de tiempo se muestre la categoría y no el ranking. Algo así como lo siguiente. Gracias.
Rango | ene-21 | feb-21 | mar-21 |
1 | Manzana | Plátano | Pera |
2 | Pera | Manzana | Naranjas |
3 | Plátano | Pera | Kiwi |
4 | Naranjas | Naranjas | Manzana |
5 | Kiwi | Kiwi | Plátano |
Solved! Go to Solution.
@Tevon713 De acuerdo, hice esto con una tabla de clasificaciones desconectada (solo 1 - 5 en una sola columna llamada Rango) y luego una tabla de "FruitsBasket". La medida es:
Fruit Rank =
VAR __Rank = MAX('Rankings'[Rank])
VAR __Table =
SUMMARIZE(
'FruitsBasket',
[FruitName],
"__Value",SUM([Value])
)
VAR __RankTable =
ADDCOLUMNS(
__Table,
"__Rank",RANKX(__Table,[__Value],,DESC)
)
RETURN
MAXX(FILTER(__RankTable,[__Rank] = __Rank),[FruitName])
Esta fue mi mesa FruitsBasket:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WciwoyElV0lHySszTNTIEMkwNDJRidRASbqlJEAkTNAnfxCKIhBFUIiA1sQjZJBNUcbhBxqjicHNgNjsl5gEhsknG6DJwszD0wE0zhMr4FyXmpacWIxtnhCEFNw9TCm4gzDvemeWZyKYZoorDjUITh5sD9kwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FruitName = _t, Month = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"FruitName", type text}, {"Month", type date}, {"Value", Int64.Type}})
in
#"Changed Type"
Tabla de clasificación:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSBEyaKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Rank = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Rank", Int64.Type}})
in
#"Changed Type"
Hola
No estoy seguro de cuánto puedo ayudar, pero me gustaría intentarlo. Comparte el enlace desde donde puedo descargar tu archivo PBI.
@Tevon713 De acuerdo, hice esto con una tabla de clasificaciones desconectada (solo 1 - 5 en una sola columna llamada Rango) y luego una tabla de "FruitsBasket". La medida es:
Fruit Rank =
VAR __Rank = MAX('Rankings'[Rank])
VAR __Table =
SUMMARIZE(
'FruitsBasket',
[FruitName],
"__Value",SUM([Value])
)
VAR __RankTable =
ADDCOLUMNS(
__Table,
"__Rank",RANKX(__Table,[__Value],,DESC)
)
RETURN
MAXX(FILTER(__RankTable,[__Rank] = __Rank),[FruitName])
Esta fue mi mesa FruitsBasket:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WciwoyElV0lHySszTNTIEMkwNDJRidRASbqlJEAkTNAnfxCKIhBFUIiA1sQjZJBNUcbhBxqjicHNgNjsl5gEhsknG6DJwszD0wE0zhMr4FyXmpacWIxtnhCEFNw9TCm4gzDvemeWZyKYZoorDjUITh5sD9kwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FruitName = _t, Month = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"FruitName", type text}, {"Month", type date}, {"Value", Int64.Type}})
in
#"Changed Type"
Tabla de clasificación:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSBEyaKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Rank = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Rank", Int64.Type}})
in
#"Changed Type"
Recién iluminado por algún gurú de PQ el otro día, se me ocurrió un método detallado para calcular el rango en lugar de ordenar,
Rank = List.Count( List.PositionOf( list, value, Occurrence.All, each _>=value ) )
Solo por diversión, aquí hay una solución de PQ basada en su abundante FruitBasket. ¡Bien!
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WciwoyElV0lHySszTNTIEMkwNDJRidRASbqlJEAkTNAnfxCKIhBFUIiA1sQjZJBNUcbhBxqjicHNgNjsl5gEhsknG6DJwszD0wE0zhMr4FyXmpacWIxtnhCEFNw9TCm4gzDvemeWZyKYZoorDjUITh5sD9kwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FruitName = _t, Month = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"FruitName", type text}, {"Month", type date}, {"Value", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "YYYYMM", each Date.ToText([Month], "MMM yyyy")),
#"Grouped Rows" = Table.Group(#"Added Custom", {"YYYYMM"}, {{"ar", each _, type table [FruitName=nullable text, Month=nullable date, Value=nullable number, YYYYMM=text]}}),
#"Added Rank" = Table.TransformColumns(#"Grouped Rows", {"ar", (t) => Table.AddColumn(t, "Rank", (r) => List.Count(List.PositionOf(t[Value], r[Value], Occurrence.All, each _ >= r[Value])))}),
#"Expanded ar" = Table.ExpandTableColumn(#"Added Rank", "ar", {"FruitName", "Rank"}, {"FruitName", "Rank"}),
#"Pivoted Column" = Table.Pivot(#"Expanded ar", List.Distinct(#"Expanded ar"[YYYYMM]), "YYYYMM", "FruitName")
in
#"Pivoted Column"
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |