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

DAX Group by on column but only display latest date budget

Consider the below table

 

iddatebudget
10101/06/2020    50
10101/07/2020    100
10301/06/2020    50
10301/07/2020    50
10301/08/2020    20

 

I'm looking to create a measures

  1. that groups by on the id col
  2. but only presents the latest entry based on date

Desired output is a table as below

 last datebudget
10101/07/2020    100
10301/08/2020    20

 

 

Thank you in advance

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @giordafrancis ,

 

 

You can use this for Last Date

 

Last Date = CALCULATE(LASTNONBLANK('Table'[date],1) ,FILTER(ALL('Table'[id]), 'Table'[id] = MAX('Table'[id])))

 

and the above mentioned measure for Last Budget.

Last Budget = 
lastnonblankvalue('Table'[date],sum('Table'[budget]))

 

 Regards,

Harsh Nathani

View solution in original post

2 REPLIES 2
harshnathani
Community Champion
Community Champion

Hi @giordafrancis ,

 

 

You can use this for Last Date

 

Last Date = CALCULATE(LASTNONBLANK('Table'[date],1) ,FILTER(ALL('Table'[id]), 'Table'[id] = MAX('Table'[id])))

 

and the above mentioned measure for Last Budget.

Last Budget = 
lastnonblankvalue('Table'[date],sum('Table'[budget]))

 

 Regards,

Harsh Nathani

amitchandak
Super User
Super User

@giordafrancis , use this for budget

lastnonblankvalue(Table[date],max(Table[budget]))

or

lastnonblankvalue(Table[date],sum(Table[budget]))

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.

Top Solution Authors