Forum Discussion

credencial's avatar
credencial
Frequent Visitor
5 years ago
Solved

Apportionment of values based ID

Hi,

I have a table:

 

 

I would like to take the first value of ID and prorate between the same IDs using DAX. Thus:

 

IDDESCONTOFRETE
16,660
16,660
16,660
203,42
203,42
203,42
203,42

 

Thanks for your any help.

  • Hi credencial ,

    You can create calculated columns like this:

    DES = 
    DIVIDE (
        FIRSTNONBLANK ( 'Table'[DESCONTO], 1 ),
        CALCULATE ( COUNT ( 'Table'[ID] ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
    )
    FRE = 
    DIVIDE (
        FIRSTNONBLANK ( 'Table'[FRTE], 1 ),
        CALCULATE (
            COUNT ( 'Table'[ID] ),
            FILTER ( ALL ( 'Table' ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
        )
    )

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • Hi credencial 

     

    Try these measures:

    DESCONTO Measure = 
    Var _MAX = max('Table'[DESCONTO])
    Var _Count=COUNT('Table'[ID_VENDA])
    return
    _MAX/_Count
    FRETE Measure = 
    Var _MAX = max('Table'[FRETE])
    Var _Count= COUNT('Table'[ID_VENDA])
    return
    _Max/_Count

    Output:

     

     

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

    Appreciate your Kudos!!

     

  • v-yingjl's avatar
    v-yingjl
    Icon for Community Support rankCommunity Support

    Hi credencial ,

    You can create calculated columns like this:

    DES = 
    DIVIDE (
        FIRSTNONBLANK ( 'Table'[DESCONTO], 1 ),
        CALCULATE ( COUNT ( 'Table'[ID] ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
    )
    FRE = 
    DIVIDE (
        FIRSTNONBLANK ( 'Table'[FRTE], 1 ),
        CALCULATE (
            COUNT ( 'Table'[ID] ),
            FILTER ( ALL ( 'Table' ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
        )
    )

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.