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
Anonymous
Not applicable

DAX Create table with each day of a month and accumulated sales for each day

Hello,

 

From a simple fact table of sales which shows the date of the sale and the amount ($) sold, connected to a Calendar table, I'm trying to find some function or group of functions that return a 2 column table according to a month defined in the function: Day of the month | Accumulated Sale

 

The accumulated sale to each of those days of the month, would also need to consider the sales of previous months.

 

I've tried using SUMMARIZE per day, and an acumulative function with CALCULATE and ALL, but I think it is not working because of the way SUMMARIZE creates the filter context.

 

Thank you very much,

 

Jesus 

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Sample data would have helped. With help from a date table

example

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[date])))

 

Without date table 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(Sales),Sales[Sales Date] <=max(Sales[Sales Date])))

Anonymous
Not applicable

Not clear what you're trying to do. Are you trying to create a calculated table in the model? A measure can't return a table, so it can't be a measure.

Anonymous
Not applicable

Yes, I want to create a calculated table in the model, or most probably I would use it as a virtual table in a measure.

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.