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

New column with data from latest entry

I am working on a project for a weight loss program. We track the participants weight and BMI each month.

Participant Data Table.PNG

I have created a table with the maximum weight, minimum weight and quick measures of the difference and % difference between the min and max.

Participant Analysis.PNG

 

What I really want to analyze, is the maximum weight to the participants weight on the last entry. To do this, I'm assuming I need to create a new column that contains the weight from the latest date. 

 

Is there a way to use DAX to automatically update the weight in this new column each time a new entry is created? I'm new to Power BI and DAX, so I'll need specific functions that I should use. 

1 ACCEPTED SOLUTION

Hi @laura_ESNH ,

 

try this.

 

 

Last Weight = CALCULATE(MAX('Table'[Weight]), FILTER(ALL('Table'[Reporting Date].[Date]), 'Table'[Reporting Date].[Date] = MAX('Table'[Reporting Date])))

 

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

6 REPLIES 6

Hi @laura_ESNH ,

 

try this.

 

 

Last Weight = CALCULATE(MAX('Table'[Weight]), FILTER(ALL('Table'[Reporting Date].[Date]), 'Table'[Reporting Date].[Date] = MAX('Table'[Reporting Date])))

 

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


I entered exactly what you sent, replacing 'Table' with my table name. I didn't get any results in the column. 

Hi @laura_ESNH ,

 

did you use a date table?

Did you create it as a measure?

Could you share a sample PBIX file?

 

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Hi @mwegener - I appreciate you sticking with me. To answer your questions...

 

I used the date field as it imports into PowerBI. After import, 

Yes, I created a measure.

Unfortunately, the organization I work for is very restrictive on sharing documents through OneDrive.

I've attached some additional screen captures. Let me know if you want to see something else.

Visual I'm trying to finish:

VisualVisual

Data

DataData

Measure

MeasureMeasure  

 

Thank you so much for your help!!

Try to remove the last ". [Date]" between the MAX brackets.
(Look at my code sample)
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Hi @mwegener - That worked! Sorry that I missed that nuance from your initial solution. I marked that post as the solution. Thanks for the help! 

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.