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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Formula

Hi, I'm looking for a formula that can make the following:

 

I have a Column (A) with values and I need to have a new column (B) with the result of the multiplication of:

Column A          formula              Column B

A1                     A1=B1        =          B1

A2                     B1 x A2       =          B2

A3                     B2 x A3       =           B3

A4                     B3 x A4       =           B4 ...

 

What I have currently:                                                                               

Bremaciel_2-1628262024830.png       

 

What I need:

 Bremaciel_1-1628261908759.png

 

Please and thank you!

 

                                                                   

 

 

5 REPLIES 5
AlexisOlson
Super User
Super User

This looks like a recursive definition. While DAX cannot handle recursion, it's often possible to reformulate the definition non-recursively. See this post for a similar situation.

 

This particular case looks fairly easy to reformulate. Column B is the cumulative product of A. Assuming you have some sort of indexing column to define the order of A (if not, add an index column in the query editor), you can define a calculated column B as follows:

B =
VAR CurrIndex = Table1[Index]
RETURN
    PRODUCTX ( FILTER ( Table1, Table1[Index] <= CurrIndex ), Table1[A] )

 

Anonymous
Not applicable

@AlexisOlson Thanks for the reply, I've tried the formula but it seems to have an error. 

Bremaciel_0-1628379277617.png

This is my table with the full info I want to show, for "Total Piezas" and "A" I'm using measures and need another measure or calculated column to show results in "B"

Bremaciel_2-1628379475688.png

Could you help me please?

 

I was assuming [A] was a table column rather than a measure. Without knowing how that measure is defined, it's hard to know what's going wrong.

@Anonymous If this is truly recursive, your odds of getting a DAX solution are slim. Believe me, I've tried over the years. Your best bet is to use Power Query as that can do true recursion.

 

DAX attempts at recursion with links to various attempts, work-arounds and how to do it in M: Previous Value (“Recursion”) in DAX – Greg Deckler



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

@Anonymous Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors