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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
nor303
Helper III
Helper III

How sum of two variables from an excel spreadsheet

Hi

 

Im new to Power BI and Im trying to sum two variables from an excel spreadsheet and call it something else. I want to sum A and C and call it G, and Sum B and E and call M for example. Is it possible to do this in the desk top without creating a new column in the data set? 

 

Thanks in advance!

 

A1000
B1500
C

600

D560
E800
F750
  
4 REPLIES 4
PhilipTreacy
Super User
Super User

Hi @nor303 

 

You can define names in the Excel workbook for your variables.  For example A_ and C_ for the cells where the corresponding values reside.

 

In Power Query, create a blank query and call it G.

 

open the Advanced Editor and use this code for this G query 

 

 

let
    A_ = Excel.CurrentWorkbook(){[Name="A_"]}[Content]{0}[Column1],
    C_ = Excel.CurrentWorkbook(){[Name="C_"]}[Content]{0}[Column1],
    Source = A_ + C_
in
    Source

 

 

The result of the query is 

 

gqr.png

 

Repeat this process for the other values/names you want to do calculations with.

 

The results of these queries can be used in other queries by using the query name, e.g.

 

 

let
    Source = G / 20
in
    Source

 

 

which gives the answer 80.

 

Regards

 

Phil

 

 

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


nor303
Helper III
Helper III

Thanks for your help! But not really the solution I was looking for. I was hoping that it was possible to make the formula within the desktop without making an extra column or shet. The reason is that next time I load a new updatet data set I was hoping that the formula automatically would do the same again.

Dhairya
Solution Supplier
Solution Supplier

Here we haven't added any new column, it's a measure which will automatically calculate the value when new data is added.
Still if you are not clear can you please share expected output?

Dhairya
Solution Supplier
Solution Supplier

Hey @nor303 
According to my understanding,
You have to first transpose this table in power query editor, which will look something like this

Dhairya_0-1687171099999.png


Then create following two Measures

G = SUM(Data[A])+SUM(Data[C])
M = SUM(Data[B])+SUM(Data[E])

After plotting all your columns and newly created measures in table visuals you will get following output
Dhairya_1-1687171533154.png


If it helps you please mark my solution as accepted.



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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