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
yakamoz007
Helper I
Helper I

Formula to substract one row from antoher

I have a table where I have to exclude the AFA value from the materail costs (green fields) and I also have to change the row AFA into a positive value (blue field).

 

I tried so much and have no ideas, which formula can help me out. :S Any ideas?pic.JPG

 

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Power BI is a reporting tool, not a business process management tool (yet).

 

Having said that - what is the relationship between the material cost row and the AFA row?  Will the AFA row always be the "next"  row according to the index? Or is there another identifier that needs to be considered? 

What if the AFA row is missing?

 

I don't think you want to do this in DAX.  This needs to be done in Power Query, or ideally at the data source.

View solution in original post

v-janeyg-msft
Community Support
Community Support

Hi, @yakamoz007 

 

I agree with @lbendlin. If you have to do with dax, you can create a calculated column.

Like this:

Column = 
VAR a =
    CALCULATE ( MAX ( 'Table'[Values] ), FILTER ( 'Table', [KNZ NR] = 444 ) )
RETURN
    IF (
        [KNZ NR] = 444
            && [Values] < 0,
        [Values] * ( -1 ),
        IF ( [KNZ NR] = 333, [Values] - a, [Values] )
    )

vjaneygmsft_0-1631610218845.png

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

View solution in original post

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @yakamoz007 

 

I agree with @lbendlin. If you have to do with dax, you can create a calculated column.

Like this:

Column = 
VAR a =
    CALCULATE ( MAX ( 'Table'[Values] ), FILTER ( 'Table', [KNZ NR] = 444 ) )
RETURN
    IF (
        [KNZ NR] = 444
            && [Values] < 0,
        [Values] * ( -1 ),
        IF ( [KNZ NR] = 333, [Values] - a, [Values] )
    )

vjaneygmsft_0-1631610218845.png

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

Thanks a lot!

lbendlin
Super User
Super User

Power BI is a reporting tool, not a business process management tool (yet).

 

Having said that - what is the relationship between the material cost row and the AFA row?  Will the AFA row always be the "next"  row according to the index? Or is there another identifier that needs to be considered? 

What if the AFA row is missing?

 

I don't think you want to do this in DAX.  This needs to be done in Power Query, or ideally at the data source.

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.