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
habibcss
Regular Visitor

manipulating cells in power bi

Hi,
I wonder if we can manipulate cells of one colomn, to create other column. For example, in this test, I want to put the first cell equal 0 then subtract the cell i-1 and the cell i

Capture1.PNG

 

 

Thank you for your cooperation and your response.
Best regards.

 

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @habibcss,

 

If I understand you correctly, you should be able to follow steps below to get your expected result.Smiley Happy

 

I assume you have a table called "Table1" like below.

 

t1.PNG

 

1. Add an Index Column for your table within Query Editor under Add Column tab.

 

index.PNG

 

2. Then you should be able to use the formula below to create a new calculate column in the table to get your expected result.

Column = 
VAR currentIndex = Table1[Index]
VAR currentValue = Table1[Value]
RETURN
    IF (
        currentIndex = 0,
        0,
        currentValue
            - CALCULATE (
                MAX ( Table1[Value] ),
                FILTER ( ALL ( Table1 ), Table1[Index] = currentIndex - 1 )
            )
    )

c1.PNG

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Employee
Employee

Hi @habibcss,

 

If I understand you correctly, you should be able to follow steps below to get your expected result.Smiley Happy

 

I assume you have a table called "Table1" like below.

 

t1.PNG

 

1. Add an Index Column for your table within Query Editor under Add Column tab.

 

index.PNG

 

2. Then you should be able to use the formula below to create a new calculate column in the table to get your expected result.

Column = 
VAR currentIndex = Table1[Index]
VAR currentValue = Table1[Value]
RETURN
    IF (
        currentIndex = 0,
        0,
        currentValue
            - CALCULATE (
                MAX ( Table1[Value] ),
                FILTER ( ALL ( Table1 ), Table1[Index] = currentIndex - 1 )
            )
    )

c1.PNG

 

Regards

Phil_Seamark
Employee
Employee

Hi @habibcss

 

Can you please post a mock up of what you would like the data to look like based on the picture you have posted?

 

It will help to clarify your requirements. 🙂


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

Proud to be a Datanaut!

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.