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
alexbalazsalex
Helper IV
Helper IV

sum up to last month

Dears,

 

I would need you support i have the below formula :

 

calculate(sum('Table'[TONS]),filter(all('Table'[Year_Month]),'Table'[Year_Month]<=max('Table'[Year_Month])))
 
It is callculating the grand total up to the selected date but not showing all customers that i have up to the selected date when i put it in the matrix next to tons.
 
Any Ideas ? thans
3 REPLIES 3
hnguy71
Memorable Member
Memorable Member

If you wanted to show all customers even when they don't have any data to provide up to max year_month consider using DatesBetween and a date table.

 

Customer Grand Total = 
var _MinDate = Min([Date])
var _MaxDate = Max([Date])
RETURN
Calculate(Sum([TONS]), DatesBetween([Date Table],_MinDate, _MaxDate))

 

 

Hope this points you in the right direction.



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

hi @hnguy71 

 

Thanks for your reply.

 

The customer has data up the the max month i selected .

 

so basicaly i have sales in Jan but the filter is set on Feb and it is calculating the totals up to Feb but not showing the customer that is strange ..

 

Any ideas ?

that's understood. Like I said, using DatesBetween should give you all the underlying data you need. Did you try that out yet?



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

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.