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
danielakunz
Helper I
Helper I

How can I cumulate values for each day?

I have 2 columns, one containing serial numbers of machines and one containing a date like a time stamp, when the machine was edited. I want to sum up the count of machines each day.

eg:

Serial no. | Date 

S1 | 2/13/2020

S2 | 2/13/2020

S3 | 2/14/2020

S4 | 2/15/2020

S5 | 2/15/2020

-> 

Date | Count | cumulated values

2/13/2020 | 2 | 2

2/14/2020 | 1 | 3

2/15/2020 | 2 | 5

 

by using a quick measure it cumulates the values, but not by each day ascending but somehow randomly.

 

Thank you very much!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

You can do it with help from date table. Now if you need cumulative to reset on month, qtr or year. use date* or total* functions. ie datesmtd, totalmtd

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

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))

 

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/

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

You can do it with help from date table. Now if you need cumulative to reset on month, qtr or year. use date* or total* functions. ie datesmtd, totalmtd

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

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))

 

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/

Tahreem24
Super User
Super User

@danielakunz ,

 

YOu need to create two measure to accomplish you requirement:

Count_Measure = CALCULATE(COUNT(Table[SNO]),ALLEXCEPT(Table,Table[DATE]))
Cumultive_Measure = CALCULATE([Count],ALL(Table),Table[DATE]<=EARLIER(Table[DATE]))
See the screen shot of your expected result below:
Capture.JPG
 
Don't forget to give thumbs up 👍 and accept this as a solution if it helped you.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

Please note that you need to have a date table in the model, and a link between the date column in the date table and the date column in the fact table. The Date[date] column mentioned is the one in the date table of course, and the Table[Date] table mentioned is the one in the fact table

Anonymous
Not applicable

CALCULATE(
                   COUNT(
                                 Table[Date],
                                 ),
                                FILTER(
                                           ALL(

                                                  Date
                                                 ),
                                                 Date[Date] <= MAX(Date[Date])
                                           )
)

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.