cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bremaciel
Frequent Visitor

Multiply a result for a value in other column

Hello, I really need help to find a dax function that multiplay result for a value in other column and go consecutive...

for example:

A1 = B1

B1 x A2 = B2

B2 x A3 = B3

B3 x A4 = B4

 

Bremaciel_0-1628102317547.png

 

Please and Thank you!!

4 REPLIES 4
wdx223_Daniel
Super User
Super User

say, you have a column that index each rows, such as 1,2,3....

B=PRODUTX(FILTER(Table,Table[Index]<=EARLIER(Table[Index])),Table[A])

V-pazhen-msft
Community Support
Community Support

@Bremaciel 


You cannot do calculation to change the existing column using DAX. You may only add another column C to have the result but you don't have column B without the calculation. So I am pretty sure you can not achieve this with DAX. 

 

 

Paul Zheng _ Community Support Team
Best Regards

 

 

 

Jakinta
Solution Sage
Solution Sage

You can try this in new blank query and adjust according to your needs.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtCztLQ0N1aK1UFlG8JFLAwt4GxzExM428wESZehpVJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    Type = Table.TransformColumnTypes(Source,{{"Column1", type number}}),
    NewColumn = Table.FromColumns( {Type[Column1], List.RemoveFirstN(List.Accumulate(Type[Column1],{1}, (s,c)=> s &  {List.Reverse(s){0}*c}), 1)}, {"A","B"}),
    FINAL = Table.TransformColumnTypes(NewColumn,{{"A", Percentage.Type}, {"B", Percentage.Type}})
in
    FINAL

Jakinta_0-1628123552341.png

 

@Jakinta Thank you, how can I use this query as a new measure? 

Bremaciel_0-1628173990345.png

Bremaciel_1-1628174005758.png

I'm using measure for values in A and need the DAX function to figure out values in B

 

Please and thank you!

 

Helpful resources

Announcements
Vote for T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors
Top Kudoed Authors