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

last value over a period

I have tables like below, note need to generate revenue1 from date and revenue using DAX.

revenue1 = revenue of max date for each year.

E.g. for 2008, revenue1 = revenue of 2008-03-01 = 300.

 

Second table shows what should be when there is only years. E.g for 2008, revenue = sum(revenue), revenue1 = 300

 

Capture.PNG

 

 

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@thotwielder Please try below as "New Column" for Revenue1 in Table1

 

Revenue1 = 
VAR _MaxDate = MAXX(FILTER(ALL(Test08),YEAR([Date])=YEAR(EARLIER([Date]))),[Date])
RETURN IF([Date]=_MaxDate,[Revenue],BLANK())

image.png

Please try below as "New Table" for your Table2 output

 

Test08Out = SUMMARIZE(Test08,Test08[Date].[Year],"Revenue",SUM(Test08[Revenue]),"Revenue1",SUM(Test08[Revenue1]))

image.png





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

Proud to be a PBI Community Champion




View solution in original post

1 REPLY 1
PattemManohar
Community Champion
Community Champion

@thotwielder Please try below as "New Column" for Revenue1 in Table1

 

Revenue1 = 
VAR _MaxDate = MAXX(FILTER(ALL(Test08),YEAR([Date])=YEAR(EARLIER([Date]))),[Date])
RETURN IF([Date]=_MaxDate,[Revenue],BLANK())

image.png

Please try below as "New Table" for your Table2 output

 

Test08Out = SUMMARIZE(Test08,Test08[Date].[Year],"Revenue",SUM(Test08[Revenue]),"Revenue1",SUM(Test08[Revenue1]))

image.png





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

Proud to be a PBI Community Champion




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.