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

Update a cell based on another column cell

Hi,

We are collecting annual data. My table is set up such that muni and year are my record's id. 

 

When we collect data for the current year (example 2024), we would ask about their expenses for 2023. In the example below, record id 1001 had a total of 10000 expenses for 2023. How do I update the 2023 expense cell to whatever value is in the temp_expenses_prev collected in 2024?

 

ncp_powerbi_1-1729844696294.png

 

This is my expected output.

 

ncp_powerbi_2-1729844826063.png

 

Note that muni and year variables are both slicers. 

 

Any help is greatly appreciated.

 

Thank you.

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ncp_powerbi ,

 

I made a sample for you with a measure.

vxiaocliumsft_0-1730085716472.png

vxiaocliumsft_1-1730085744840.png

expense = 
VAR _year=MAX('Table1'[year])+1
VAR _muni=MAX('Table1'[muni])
VAR _value=CALCULATE( SUM(Table1[temp_expenses_prev]),'Table1'[year]=_year,'Table1'[muni]=_muni)
RETURN _value

 

Best Regards,

Wearsky

View solution in original post

4 REPLIES 4
Ray_Minds
Continued Contributor
Continued Contributor

Hi  @ncp_powerbi 

Please find my solution as below and let me know in case of any issue.

 

Overview: - I have loaded the dataset provide by you in the 'Order' table, which looks like below snapshot: -

Ray_Minds_10-1733896951962.png

 

 

Please find the solution steps as below: - 
 
1.  Create a Measure for Total Units on Order : First, you need to create a measure that calculates the total units on order for each product. 

Ray_Minds_9-1733896929640.png

 

 

 

2. Create a Measure for 60% of Total Units : Next, create a measure to determine 60% of the total units on order for each product.

Ray_Minds_11-1733896980328.png

 

3. Calculate Cumulative Sum of Units on Order : To determine the cumulative sum of units on order by shipped date, create a new measure: 

  

Ray_Minds_12-1733897001429.png

 


4.  Create a Measure for Ship Date : Now, create a measure that finds the minimum shipped date when the cumulative units exceed or equal 60% of the total units on order. 

Ray_Minds_13-1733897020879.png

 

 

5.  Create a New Table : Finally, create a new table to show the desired output. You can use the following DAX formula in the "New Table" option: 

  

Ray_Minds_14-1733897042052.png

 

This will give you a new table with the product, total units on order, and the date when at least 60% of the units on order have shipped.  

  

You can now visualize this result in your Power BI reports! Which will look like below snapshot: - 

Ray_Minds_15-1733897107428.png

 


If this solution resolves your issue, you can let us know by marking my post as a solution which can help the other community members to find it more quickly. 

 

Anonymous
Not applicable

Hi @ncp_powerbi ,

 

I made a sample for you with a measure.

vxiaocliumsft_0-1730085716472.png

vxiaocliumsft_1-1730085744840.png

expense = 
VAR _year=MAX('Table1'[year])+1
VAR _muni=MAX('Table1'[muni])
VAR _value=CALCULATE( SUM(Table1[temp_expenses_prev]),'Table1'[year]=_year,'Table1'[muni]=_muni)
RETURN _value

 

Best Regards,

Wearsky

ncp_powerbi
Frequent Visitor

Hello,

 

Thank you for the response. Yet I cant seem to make it work.

 

I will be calculating the previous year's expenses based on the current year.  So for example, I have new data in 2024 and save that 2023 data in the variable temp_expenses_prev. 

 

How do I modify your code above such that the value in temp_expenses_prev will be copied to the previous year expense column? this is my expected output

 

muniyearexpensetemp_expenses_prev
1001202310000 
10012024 10000
1002202220000 
100220233000020000
10022024 30000

 

 

 

danextian
Super User
Super User

Hi @ncp_powerbi ,

 

Try the following:

Prev Year = 
CALCULATE (
    SUM ( 'Table'[Expense] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[muni] = EARLIER ( 'Table'[muni] )
            && 'Table'[year]
                = EARLIER ( 'Table'[year] ) - 1
    )
)

danextian_0-1729845811554.png

Also, going forward, please post a sample data that can be copy pasted as text and not an image.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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.