Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

sum column of variable table power bi

Hi All,

 

I'm trying to cumulate values from values from calculated (dax)-table. I've tried to use SUMX, but it's not working. Does someone know how to sum all these values? As displayed in Excel?

 

Let me know, thanks in advance.

PowerBICumulateStock.png 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Has discussed and taking into account that you already have a calculation line by line that is correct and so that you don't overthink the calculation just create a measure SUMX based on the first measure something similar to:

 

Test of YTD = SUMX(Dates, [Stock Start])

 

Regards

 

Has you can see below the result is correct, so insted of using the Omloopsnelheid Product YTD2 measure use the Test one.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

In my opinion, your formula is in a little mess. Why did you need to create a temporary table in your measure. Just use the following measure:

 

Measure =
VAR _stockcount =
    CALCULATE (
        SUM ( 'WMS'[Mutatie Aantal] ),
        FILTER ( ALL ( Dates ), Dates[Date] ) < MAX ( Dates[Date] )
    )
RETURN
    IF ( _stockcount = BLANK (), 0, _stockcount )

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Anonymous
Not applicable

Dear @v-deddai1-msft , 
Thank you for your reply. I've tried you're code but it shows an error: "A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.". Hence, I've adapted the code to:

Test = 

VAR _stockcount =

CALCULATE (

SUM ( 'WMS Data'[Mutatie Aantal] ),

FILTER ( ALL ( Dates ), Dates[Date] < MAX ( Dates[Date] ))

)

RETURN

IF ( _stockcount = BLANK (), 0, _stockcount )

Let me know if this did alter the functionality of the formula.


In regards to the table, I've created the temporary table to see the stock level on a daily basis, hoping to be able to SUM the column later (like I do with a normal column). Looking to your code, I get the same results for the daily basis. However, I'm also not able to have a cumulative value if I SUM each day (red).PBI.PNG

Hi @Anonymous ,

 

Would you please share me the pbix file? There could be some external filter on the visual.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

 

 

MFelix
Super User
Super User

Hi @Anonymous ,

 

I can see you have more information that the columns that are presented and that you are using them on your measure can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.

 

Also do you want to have a cumulative value on the column or only on the total?


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Dear @MFelix ,

 

Thank you for the offer, I'll send you a link in a private message. The main goal is to calculate the average number of items per day in our warehouse (if stock > 0). Therefore I need the total. 

 

The mockup data contains only two article numbers. In reality we have around 80.000. I want to be able to see the average stock per day for every single article. Let me know if you need a better way to accomplish this.

 

Kind regards,

TGB

Hi @Anonymous ,

 

Has discussed and taking into account that you already have a calculation line by line that is correct and so that you don't overthink the calculation just create a measure SUMX based on the first measure something similar to:

 

Test of YTD = SUMX(Dates, [Stock Start])

 

Regards

 

Has you can see below the result is correct, so insted of using the Omloopsnelheid Product YTD2 measure use the Test one.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.