Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Rangos por Categoría

Estimado todo, tengo un dato como abajo y me gustaría calcular los rangos basados en RNO_Condition.

Datos:-

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Tc07CoUwEEDRrTymlpCZ/LC0faAWlhKCYEBBYooUunsTVLC9p7jjCCiMNC74HSoQSJwpAlu9vU9L7sgFVwzFB4a4hmkrVhtG6haJWrluT792itHPRUkzTR9twrH6dGYiw58uEd0/lX++SLD2Ag==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [RNO_Condition = _t, Amt = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"RNO_Condition", type text}, {"Amt", type number}})
in
    #"Changed Type"

He escrito a continuación dax y basado en que estoy recibiendo la salida que se muestra a continuación

MohanV_0-1602696891276.png

Pero estoy esperando la clasificación como la imagen de abajo.

MohanV_1-1602696940899.png

Cualquier ayuda, por favor.

Gracias

Mohan V.

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Hola, @MohanV , ya que desea clasificar las entradas dentro de un subgrupo, le sugiero que agregue una columna, ya sea en PQ o por columna calculada, para distinguir diferentes subgrupos.

#"Extract Prefix" = Table.AddColumn(#"Changed Type", "Category", each Text.Start([RNO_Condition], 5))

o usando la columna calculada Screenshot 2020-10-14 201905.png

La medida es

Ranks = 
VAR __cat = MAX ( 'Dataset'[Category] )
RETURN
    RANKX (
        FILTER ( ALL ( 'Dataset' ), 'Dataset'[Category] = __cat ),
        CALCULATE ( MAX ( 'Dataset'[Amt] ) )
    )

Screenshot 2020-10-14 202337.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

3 REPLIES 3
CNENFRNL
Community Champion
Community Champion

Hola, @MohanV , ya que desea clasificar las entradas dentro de un subgrupo, le sugiero que agregue una columna, ya sea en PQ o por columna calculada, para distinguir diferentes subgrupos.

#"Extract Prefix" = Table.AddColumn(#"Changed Type", "Category", each Text.Start([RNO_Condition], 5))

o usando la columna calculada Screenshot 2020-10-14 201905.png

La medida es

Ranks = 
VAR __cat = MAX ( 'Dataset'[Category] )
RETURN
    RANKX (
        FILTER ( ALL ( 'Dataset' ), 'Dataset'[Category] = __cat ),
        CALCULATE ( MAX ( 'Dataset'[Amt] ) )
    )

Screenshot 2020-10-14 202337.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Megha166
Employee
Employee

¿Su cálculo está creando grupos primero sobre la base del número de prefijo en RNO_Condition y luego la clasificación sobre la base de Amt?

@MohanV Mira esto.

https://community.powerbi.com/t5/Desktop/DAX-Ranking-within-a-group/td-p/261079

Avísame si aún necesitas ayuda. Escribiré la Expresión DAX para ti.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.