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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ESG
New Member

Create a column that returns value of another column while keeping the original value if no matches

Hi all,

 

I'm completely new to PowerBI and have been exploring posts on the community board, but I can't seem to find a solution to my query and I really need help.

 

I have a table with 3 companies ranging across year 2022 and year 2023.

 

ESG_0-1711958320838.png

 

I am trying to insert a new column called 'No. of customers at investment', which is actually the number of customers at start of year for 2022:

 

ESG_1-1711958480514.png

 

How do I create a column that would return the value of 'No. of customers at start of year' for year 2022, regardless of whether the 'Year' column is 2022 or 2023?

 

Many thanks in advance!  

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ESG ,

Your solution is great, @Jihwan_Kim . It works like charm! Here, I have another idea, I want to share it for reference. I used the calculation column instead of Measure.

Investment =
CALCULATE (Max ('Table' [Start]), Filter (all ('table'), 'table' [year] = 2022 && 'table' [company name] = Earlier ('table' [company name]))

The final result is shown in the figure below.

vkaiyuemsft_0-1712022822206.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

3 REPLIES 3
ESG
New Member

thank you very much @Jihwan_Kim and @Anonymous for your guidance! 

Anonymous
Not applicable

Hi @ESG ,

Your solution is great, @Jihwan_Kim . It works like charm! Here, I have another idea, I want to share it for reference. I used the calculation column instead of Measure.

Investment =
CALCULATE (Max ('Table' [Start]), Filter (all ('table'), 'table' [year] = 2022 && 'table' [company name] = Earlier ('table' [company name]))

The final result is shown in the figure below.

vkaiyuemsft_0-1712022822206.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

Jihwan_Kim_0-1711959651493.png

 

Jihwan_Kim_1-1711959832869.png

 

# customers at investment: =
CALCULATE ( SUM ( data[#_customers_start_of_year] ), 'year'[year] = 2022 )

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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