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
Giavo
Helper III
Helper III

Col - (Col-1row)

Hello all,

 

i have a column with cumulative numbers inside. As i don't want it cumulative but just the delta, i thinked of substraction between the value and value-previous(date). Can you help me with how to do it?  Thank you

1 ACCEPTED SOLUTION

Hello , i'm posting the solution to my problem so it can be usefull to others in the future:

 

Delta= IF(ISBLANK(CALCULATE(MAX([VALUE]),

ALL(Table),Table[PROJECT ID]=

EARLIER(Table[PROJECT ID]),Table[DATE]<EARLIER(Table[DATE]))),0,

[VALUE]-CALCULATE(MAX([VALUE]),ALL(Table),Table[PROJECT ID]=EARLIER(Table[PROJECT ID]),Table[DATE]<EARLIER(Table[DATE])))

View solution in original post

8 REPLIES 8
Giavo
Helper III
Helper III

Capture.PNG

Hello , i'm posting the solution to my problem so it can be usefull to others in the future:

 

Delta= IF(ISBLANK(CALCULATE(MAX([VALUE]),

ALL(Table),Table[PROJECT ID]=

EARLIER(Table[PROJECT ID]),Table[DATE]<EARLIER(Table[DATE]))),0,

[VALUE]-CALCULATE(MAX([VALUE]),ALL(Table),Table[PROJECT ID]=EARLIER(Table[PROJECT ID]),Table[DATE]<EARLIER(Table[DATE])))

Hello all,

 

i have a column with numbers and it is cumulative. As i don't want it in a cumulative form but just the delta between the rows, i wanted to simply substract the same column with the previous row to have just a delta. Any idea of how to do it ? Thank you all

Hi @Giavo,

If you just substract the previous rows, you can add an index column in Power Query by clicking "Add index column" under "Add column" on home page. Then you can create a calculated column using the formula.

NewColumn=Table[Column]-LOOKUPVALUE(Table[Column],Table[index],Table[index]-1)


In addition, I am not clear your requirement: I don't want it in a cumulative form but just the delta. Could you please share more details, or list sample table and expected result?

Best Regards,
Angelia

 

Thank you for your reply, i added some more clear details of my problem as you can see

EDIT: and per every stage i have a PLANNED DATE column. So insted of INDEX column, is it possible to calculate the delta column with PLANNED DATE(earlier) and not with INDEX(earlier) ?

Phil_Seamark
Employee
Employee

Hi @Giavo

 

If you have an index column this is pretty easy using the following calculated column.  If you don't have an index column you can add one in the Query Editor using the add index column feature.

 

Delta Column = 
        'Table3'[Actual] - CALCULATE(
                                    MIN('Table3'[Actual]),
                                    FILTER(
                                         ALL('Table3'),
                                        'Table3'[Index] = EARLIER('Table3'[Index]) -1)
                                        )

delta.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thank you for the reply, it works with your data. But not with mine. I have a table with 10K rows. PROJECT ID and VALUE(cumulative). Per every PROJECT ID i have different stages. So adding just an index column doesn't solve the proble because i guess the order is not always from 0 to 10000. It can be different.

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.