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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Sum values current date - sum values last date

I am trying to subtract the values of the current date from the day before the current date.

 

What I have:

 

Measure = CALCULATE(SUM(Base[MCL Current value SEK]);ALLSELECTED(Base[Date])) - CALCULATE(SUM(Base[MCL Current value SEK]);FILTER(Base;Base[Date]=Base[Column]))
 
Where "Column" is the day before current date
 
Result:
 
MonthDayMCL ValueMeasure
Feb

27

4.281.365,550
Feb284.418.949,874.418.949,87
Mar34.418.949,874.418.949,87
Mar43.582.675,833.582.675,83
Mar53.582.675,833.582.675,83
Mar64.416.023,924.416.023,92
Mar97.158.087,637.158.087,63

 

 

3 REPLIES 3
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Let me know if you'd like to get below results:

Measure = CALCULATE(MAX('Table'[MCL Value]),FILTER(ALL('Table'),[Day]=MAX('Table'[Day])-1))

07.PNG

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Anonymous
Not applicable

I want to subtract the sum of the current date with the last date of the current date.

 

I can't use "(date)-1" because it is not going to be always -1, it depends if we have holidays or weekend.

 

I need to count automatically the number of one day to another, example:

 

Column:

var last_date= CALCULATE(maxx(Base;Base[Date]);filter(Base;Base[Date]<EARLIER(Base[Date])))
return previous_day_count = DATEDIFF(Base[Date];Base[Dia_Anterior_tag];DAY)
 
This way I can use "previous_day_count" into "-1".
 
And also, the column "MCL Value" is a sum, not a maximum value.

 

amitchandak
Super User
Super User

Using date calendar date you can do like

CALCULATE(SUM(Base[MCL Current value SEK]);Dateadd('Date'[Date],-1,DAY))

Or example

last date having data

Measure =
var _max = maxx(allselected(Date),Date[DAte]) // or take Today()
//OR var _max = maxx(allselected(Sale),Sales[DAte]) // or take Today()

var _max2 = MAxx(filter(sales,sales[Date]<_max),sales[Date])

return
calculate(sum(sales[value]),Date[Date] =_max2)

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.