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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
pacoduabe
Regular Visitor

Complex DAX Expression PRODUCTX nested in SUMX

Hello! i need to create a complex calculated column. Here is the sample data:

IndexStepValue
005
137
266
398
4127

The new column must follow this logic:

Column(0) = Value(0)

Column (1) = Value(1) + 10 · Value(0) · (Step(0) - Step(1))

Column (row = 2) = Value(2) + 10 · Value(1) · (Step(1) - Step(2)) + 10^2 · Value(0) · (Step(1) - Step(2)) · (Step(0) - Step(1))

Column (row = 3) = Value(3) + 10 · Value(2) · (Step(2) - Step(3)) + 10^2 · Value(1) · (Step(2) - Step(3)) · (Step(1) - Step(2)) + 10^3 · Value(0) · (Step(2) - Step(3)) · (Step(1) - Step(2)) · (Step(0) - Step(1))

...

I tried this DAX expression, but I cannot get the current iteration the SUMX. 

 

VAR __Ind = Data[Index]
RETURN
    CALCULATE(
        SUMX(
            FILTER( Data, Data[Index] >= __Ind - 2 && Data[Index] <= __Ind ),
            VAR __i = Data[Index]
            RETURN
                PRODUCTX (                
                    FILTER ( ALL(Data), [Index] <= __i  && [Index] > 0),
                    Data[PreviousTimeStamp] - Data[TimeStamp]  // Replacing __i with [Index] to store the actual iteration of SUMX
                )
        )
    )
1 REPLY 1
amitchandak
Super User
Super User

@pacoduabe , if need recursive calculation, then I doubt you can get it DAX.

 

But it can work with cumulative the earlier can help

Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8
https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s

 

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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