Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
afaro
Helper I
Helper I

Seeing sum for the last day of the month only for all dates of the month

I have a table something like this: 

DateProductValue
1 Jan 2020A10
1 Jan 2020B20
2 Jan 2020A20
2 Jan 2020B30
3 Jan 2020A40
3 Jan 2020B50

 

I want to see tables like this

DateLast Aggregate Value
1 Jan 202090 
2 Jan 202090
3 Jan 202090



90 is the sum of the last value on the month. 
If we are on the current date i.e. today then I want to see the value for sum on today

1 ACCEPTED SOLUTION
v-kongfanf-msft
Community Support
Community Support

Thanks for the reply from @vicky_ , please allow me to provide another insight:

 

Hi @afaro ,

 

If you want to present this result as a table. You can refer to the following formula in calculated table:

result = 
VAR LastDateOfMonth =
    LASTDATE ( 'Table'[Date] )
VAR LastAggregateValue =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        'Table'[Date] = LastDateOfMonth
    )
RETURN
    SUMMARIZE('Table','Table'[Date],"Aggregate Value",LastAggregateValue)

vkongfanfmsft_0-1714548533998.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-kongfanf-msft
Community Support
Community Support

Thanks for the reply from @vicky_ , please allow me to provide another insight:

 

Hi @afaro ,

 

If you want to present this result as a table. You can refer to the following formula in calculated table:

result = 
VAR LastDateOfMonth =
    LASTDATE ( 'Table'[Date] )
VAR LastAggregateValue =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        'Table'[Date] = LastDateOfMonth
    )
RETURN
    SUMMARIZE('Table','Table'[Date],"Aggregate Value",LastAggregateValue)

vkongfanfmsft_0-1714548533998.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

vicky_
Super User
Super User

Try something like this: 

Last Aggregate Value = 
var lastDateOfMonth = CALCULATE(MAX('Table'[Date]), ENDOFMONTH('Table'[Date])) // get the max day per month
return CALCULATE(SUM('Table'[Value]), ALL('Table'[Date]), KEEPFILTERS('Table'[Date] = lastDateOfMonth))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.