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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Isma
Frequent Visitor

Calculate weights in DAX

Hi,

Appreciate if someone could help me. Thank you

I have a pivot table and would like to add new measure

I would like to calculate weights for each row. Sample as below

if row number=1 then 0.06

else 0.94 * previous row value

Isma_0-1646748786561.png

Isma_1-1646749216436.png

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Isma ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
IF (
    MAX ( 'Table'[Row number] ) = 1,
    MAX ( 'Table'[Row number] ) * 0.06,
    0.06
        * POWER ( 0.94, MAX ( 'Table'[Row number] ) - 1 )
)

vpollymsft_1-1646980985897.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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
Anonymous
Not applicable

Hi @Isma ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
IF (
    MAX ( 'Table'[Row number] ) = 1,
    MAX ( 'Table'[Row number] ) * 0.06,
    0.06
        * POWER ( 0.94, MAX ( 'Table'[Row number] ) - 1 )
)

vpollymsft_1-1646980985897.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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

 

 

 

 

Jihwan_Kim
Super User
Super User

Hi,

Sorry that I only know how to do this in Power Query.

If you are interested in knowing how to do this in Power Query, please check the attached file.

 

1. Open pbix file

2. go to "Transform data"

3. New source -> blank query -> create a function.

   when you open advanced editor, you can see the query like below.

 

let
Source = (x as number) as number =>
let f = function(x-1) * 0.94
in
if x=1 then 0.06 else f
in
Source

 

 

4. In Data query, add invoke custom function. 

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.