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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.