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
dragonus
Helper III
Helper III

How do I create a measure that returns the latest's month value?

Hi, do know this question has been asked before, but I can't seem to have them work.

 

I have 3 columns, Date, Attribute, Value. Date basically shows the monthly date (01/07/2020, 01/06/2020), attribute shows different locations (eg Florida/Alabama/etc) and the Value shows the amount collected that month (eg 20.39, 20.30).

 

I wanted to show the latest month's collection (eg July); there should be only 1 attribute since they are unique:

 

DateAttributeValue
01/07/2020Alabama20.38
01/07/2020Florida20.30
01/07/2020Washington232.10
01/07/2020Michigan293.12
1 ACCEPTED SOLUTION

@dragonus 

Great!,

The measure works as well, hope you tried this measure 

 (MAX(Data2[Date]) = CALCULATE(MAX(Data2[Date]),ALLSELECTED(Data2[Date])))*1


If you are satisfied with my answer, please accept it as a solution so others easily find it.
Appreciate KUDOS!

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

7 REPLIES 7
Fowmy
Super User
Super User

@dragonus 
Do you wanna show only the last row or the total for July in your sample data?

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy 

 

I would like to see July values for all of the attributes. Total is not needed.

@dragonus 

You can add the Following Measure to Visual Filter.

 

Last_Month = 
    (MAX(Data2[Date]) = CALCULATE(MAX(Data2[Date]),ALLSELECTED(Data2[Date])))*1

 


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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy 

 

Not too sure what I am doing wrong, but it did not help. Please see my screenshots:

Followed your filter (LatestMonth is the measure that you mentioned)

dragonus_1-1594539118312.png

dragonus_3-1594539191730.png

 

Table did not change... Still shows values that are past:

 

dragonus_0-1594539094168.png

 

@dragonus 

Your sample data shows the date in a single column, but you have Y,M and D in separate columns, create a single data column and try. Drop The Measure in Visual Filter as I showed below.

Use my modified Mesure 

Fowmy_0-1594539448844.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

I tried your solution but used New Columns instead of Measure and it worked. But was wondering why was it behaving this way?

@dragonus 

Great!,

The measure works as well, hope you tried this measure 

 (MAX(Data2[Date]) = CALCULATE(MAX(Data2[Date]),ALLSELECTED(Data2[Date])))*1


If you are satisfied with my answer, please accept it as a solution so others easily find it.
Appreciate KUDOS!

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.