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

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

Reply
Pongpon
Regular Visitor

Calculate row step like Excel

Hi Community, 

 

I want to calculate data in Power Query like Excel example. I tried many ways but failed. 

 

Value,

Pongpon_4-1628480831985.png

 

 

Formular,

Pongpon_5-1628480847667.png

 

Thank you.

 

 

3 ACCEPTED SOLUTIONS
wdx223_Daniel
Super User
Super User

ziying35
Impactful Individual
Impactful Individual

try this:

// output
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    acc = List.Accumulate(
               Source[Column1], 
               {null, {}}, 
               (s,c)=>let n=s{0}??List.Sum(Source[Column1]) 
                      in {n*2.32+c-n, s{1}&{{c, n, n*2.32, n*2.32+c, n*2.32+c-n}}}
          ),
    result = Table.TransformColumns(#table(null, acc{1}), {}, each Number.Round(_, 2))
in
    result

View solution in original post

11 REPLIES 11
ziying35
Impactful Individual
Impactful Individual

try this:

// output
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    acc = List.Accumulate(
               Source[Column1], 
               {null, {}}, 
               (s,c)=>let n=s{0}??List.Sum(Source[Column1]) 
                      in {n*2.32+c-n, s{1}&{{c, n, n*2.32, n*2.32+c, n*2.32+c-n}}}
          ),
    result = Table.TransformColumns(#table(null, acc{1}), {}, each Number.Round(_, 2))
in
    result

Thank you.

wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1628486705668.png

 

Hi, thank you for the help me.

I try add column number for calculate.

But the data is retrieved only for the first column.

Pongpon_2-1628857675929.png

 

Pongpon_0-1628857274358.png

Calculate like this

Pongpon_0-1629129226735.png

 

Thank you.

I want to add group in data like this, 

Pongpon_0-1628507820949.png

How to edit code?

Thank you.

wdx223_Daniel_0-1628555287915.png

 

Thank you very much.

Thank you!

But i put same code in Power Query for Power BI, Not work.

Pongpon_1-1628497034520.png

 

your column1 is text, it should be number

Thank you, you have my life. 😊

Anonymous
Not applicable

Great, Can you send .pbix file to my email. (namphon.chailungka@gmail.com)
Thank you so much.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Kudoed Authors