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

Add rows that they are missing and adding cumulative sum

Hei all,

I have a table similar this:

Rick_ferreira_0-1631812055974.png


However I need to buil using dax a table similar this:

Rick_ferreira_1-1631812103027.png


I need to add the rows with data is missing and after to add the column with sum cumulative.

Is it possible to build this?

Regards,



1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Try the below steps:

Step1,create date table and enter  product table:

Table2 = CALENDAR("2020,1,1","2020,1,5")

vluwangmsft_0-1632818539120.png

Step 2,crossjoin the two table:

Table4 = CROSSJOIN(Table2,Table3)

vluwangmsft_1-1632818576437.png

Step3,get the base table value:

value = CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[Date]=Table4[Date]&&'Table'[Product]=Table4[Product]))

Step 4,get the sum value the date<= earlier(date)

Column = CALCULATE(SUM(Table4[value]),FILTER(ALL(Table4),Table4[Product]=EARLIER(Table4[Product])&&Table4[Date]<=EARLIER(Table4[Date])))

Output result:

vluwangmsft_2-1632818665389.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Try the below steps:

Step1,create date table and enter  product table:

Table2 = CALENDAR("2020,1,1","2020,1,5")

vluwangmsft_0-1632818539120.png

Step 2,crossjoin the two table:

Table4 = CROSSJOIN(Table2,Table3)

vluwangmsft_1-1632818576437.png

Step3,get the base table value:

value = CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[Date]=Table4[Date]&&'Table'[Product]=Table4[Product]))

Step 4,get the sum value the date<= earlier(date)

Column = CALCULATE(SUM(Table4[value]),FILTER(ALL(Table4),Table4[Product]=EARLIER(Table4[Product])&&Table4[Date]<=EARLIER(Table4[Date])))

Output result:

vluwangmsft_2-1632818665389.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

amitchandak
Super User
Super User

@Anonymous , I think if you use a date table joined with date of your table. Also you need to use date from date table in visual

 

Cumm Sales = CALCULATE(SUM(Table[Values]),filter(allselected(date),date[date] <=max(date[Date])))

 

If needed add +0

 

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 :radacad sqlbi My Video Series Appreciate your Kudos.

 

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.