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

How to calculate Cumulative Totals when there are missing dates ?

Hello! I am fairly new to PowerBI development and DAX queries in general and I am finding it incredibly hard to understand the language and get help in general. Here is my problem : 

 

I have sales data at a month level in Table 1 and a standard date table called TimeDim. The blank values are due to missing information in Table 1 for the corresponding months. Pretty standard. Both the tables are joined on Date. 

 

Month Nominations
Jan, 2018     
Feb, 2018 
Mar, 20182
Apr, 2018 
May, 2018
Jun, 20182
Jul, 20184
Aug, 20184
Sep, 20181
Oct, 20181
Nov, 20182
Dec, 201815
Jan, 201910
Feb, 20192
Mar, 20193
Apr, 20197
May, 20196
Jun, 2019 
Jul, 20193
Aug, 201944
Sep, 201943
Oct, 2019233
Nov, 2019655
Dec, 20192022

 

As seen everywhere, the standard DAX code for cumulative totals is 

cumu_total = calculate(sum(table1'[Nominations]), filter(timedim, timedim'[date] <= max(timedim'[date]))) which should provide me the cumulative totals at a month level. 

I am using timedim in the filter expression since I already joined them. Now here are the values I get which I am unable to explain or understand. I tried sumx(), used table 1 instead of timedim, used +0, and none of them work. 

 

The following months are erroneous: 

Apr 2019 

Aug 2019

Sep 2019 and so on 

Month#NominationsCumulative Nominations
Jan, 2018  
Feb, 2018  
Mar, 201822
Apr, 2018 2
May, 2018 2
Jun, 201824
Jul, 201848
Aug, 2018412
Sep, 2018113
Oct, 2018114
Nov, 2018216
Dec, 20181531
Jan, 20191041
Feb, 2019243
Mar, 2019346
Apr, 2019751
May, 2019655
Jun, 2019 55
Jul, 2019358
Aug, 201944101
Sep, 201943140
Oct, 2019233363
Nov, 2019655990
Dec, 201920222874

 

Please provide me with some direction on how to address this as DAX solutions, are extremely hard to find and understand.

Thank you very much. I hope I have provided the context completely. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6 REPLIES 6
amitchandak
Super User
Super User

You should use a calendar that has continuous dates.

Try like

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

I have been searching for 3 days for the answer to my problem. You are amazing!! Thank you so much for sharing your pbix file so I can actually follow what's going on!!!!

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Sir,

do we have the above PBI file in this case. it seems same problem.

I do not have that file now.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Could you please provide Dax logic if you have.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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