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
shashar11
Frequent Visitor

Create calculated column based on another sheet

Hello -

 

I have a spreadsheet with multiple sheets. Sheets 1 has some data .
Sheet 2 has a holiday schedule. I need to upload both sheets to the Power BI and create a calculated column called based on sheet 1 and sheet 2(holiday schedule).
Please note there is no relation between sheet 1 and sheet 2 and different columns names are present in both sheets.
Can someone please advise if its doable and how?

1 ACCEPTED SOLUTION
5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @shashar11 

 

If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

 

Best Regards

Allan

v-alq-msft
Community Support
Community Support

Hi, @shashar11 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table1:

d1.png

 

Table2:

d2.png

 

There is no relationship between two tables. You may create two calculated columns as below.

NewColumn1 = LOOKUPVALUE(Table1[ProductName],Table1[ProductID],Table2[PID])

NewColumn2 = 
CALCULATE(
    SUM(Table2[Sales]),
    FILTER(
        ALL(Table2),
        Table2[PID]=EARLIER(Table1[ProductID])
    )
)

 

d3.png

 

Result:

Table1:

d4.png

 

Table2:

d5.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@shashar11 , as long as these are common column you can able to create a new column in the table from other tables likes

example new column in sales from City table

City Name = maxx(FILTER(geography,geography[City Id]=Sales[City Id]),geography[City])

 

City Name = countx(FILTER(geography,geography[City Id]=Sales[City Id]),geography[City])

 

You can use additional condition and replace maxx with minx , sumx etc

Christophe
Helper II
Helper II

The contents of your sheet1 and sheet2 will be transformed into two tables in Power BI.

 

A "calculated column" in Power BI applies to a row within a table. Usually it won't let you work with two tables especially as they are not related.

 

What you are probably looking for is a measure. The formula for the measure can take content from multiple tables and will of course depend on your specific requirements.

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.