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
Anonymous
Not applicable

Subtract specific value from each row of a column

Hello community. My problem is the follow:

F total / y total = 4.5151.

I would like to substract the above value (4.5151) from each row of w column an create a new column from the results (The w column is the result of F / y columns). For instance

4.5151 - 3.38 = 1.1351, 4.51.51 - 4.5 = 0.0151. In excel is very easy but I can't do it on PowerBI.

Please also have in your mind that I have filter the hour column to have specific hours and also I have a sclicer to select date and month.

Can you help me please?

 

test.PNG

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Create a Calculated Column

 

Cc = 
var a = SUM('Table'[F])
var b = SUM('Table'[y])
var div = DIVIDE(a,b)
RETURN
div - 'Table'[w] 

 

 

1.jpg

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Create a Calculated Column

 

Cc = 
var a = SUM('Table'[F])
var b = SUM('Table'[y])
var div = DIVIDE(a,b)
RETURN
div - 'Table'[w] 

 

 

1.jpg

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Fowmy
Super User
Super User

@Anonymous 

Add these two measures:

W Column:

w = 
VAR L = DIVIDE(
    SUM([F]),
    SUM([Y])
)

VAR FTOTAL = CALCULATE(SUM([F]),ALLSELECTED('DATA'))
VAR YTOTAL = CALCULATE(SUM([Y]),ALLSELECTED('DATA'))
VAR GTOTAL = DIVIDE(FTOTAL,YTOTAL)
RETURN
IF(
    HASONEVALUE('DATA'[F]),
    L,
    DIVIDE(
        FTOTAL,
        YTOTAL
    )


New Column Measure:

New Column = 
VAR FTOTAL = CALCULATE(SUM([F]),ALLSELECTED('DATA'))
VAR YTOTAL = CALCULATE(SUM([Y]),ALLSELECTED('DATA'))
VAR GTOTAL = DIVIDE(FTOTAL,YTOTAL)
RETURN
IF(
    HASONEVALUE('DATA'[F]),
    [w] - GTOTAL
    ,
    BLANK()
)

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn







 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

amitchandak
Super User
Super User

@Anonymous , Try like

calculate(divide(sum(Table[F]),Sum(Table[y])), all(Table)) - divide(sum(Table[F]),Sum(Table[y]))

or

calculate(divide(sum(Table[F]),Sum(Table[y])), allselected(Table)) - divide(sum(Table[F]),Sum(Table[y]))

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.