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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
credencial
Frequent Visitor

Apportionment of values based ID

Hi,

I have a table:

 

credencial_0-1634244295079.png

 

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.

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community 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] ) )
    )
)

vyingjl_0-1634694774030.png

 

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.

 

View solution in original post

2 REPLIES 2
v-yingjl
Community Support
Community 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] ) )
    )
)

vyingjl_0-1634694774030.png

 

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.

 

VahidDM
Super User
Super User

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:

 

VahidDM_0-1634333615525.png

 

 

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

Appreciate your Kudos!!

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.