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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
yve214
Helper III
Helper III

Sumx function isn't working

Hi there,

 

please help me.

 

my sumx function isnt working for a total qty measure i calculated.

 

I have my Qty measure where I am replacing my empty rows with the previous values as such

 

final Qty = 

VAR CurrentValue =
SUM ( data[qty])
VAR PreviousValue =
if(
sum(data[qty]) = BLANK(),
CALCULATE(
sum(data[qty]),
date[date_dt] = MAX(date[date_dt])-1,
))
RETURN
if(
max(date[date_dt]) =max(date[date_dt]) ,
CurrentValue + PreviousValue,
CurrentValue
)
 
When I put this total on my table view, I dont get the iterative total by the dates as I would like to see. It is giving me the total qty logic as if I was jusr doing a sum(qty).
 
Iterative Qty = sumx(values(date[date_dt]), [final Qty]) (this should add up all the values on the views itself but when I look at it, the rows are correct but the total is still wrong. I had to export it to excel and noticed its not working)
 
Any other way to add my iterative values for my view?
1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @yve214 ,

According to your description, please try this code:

Iterative Qty =
IF (
    HASONEVALUE ( date[date_dt] ),
    [final Qty],
    SUMX ( VALUES ( date[date_dt] ), [final Qty] )
)

Additionally, please see if this blog helps: Learn How to Fix Totals and Subtotals in DAX

 

Best Regards,
Community Support Team _ kalyj

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

View solution in original post

3 REPLIES 3
yve214
Helper III
Helper III

@v-yanjiang-msft ,

 

Thank you so much for ahelping. Unfortunately in this instance it didnt work. Still got the same result but I can see how this will help with every other generic situation so thank you.

v-yanjiang-msft
Community Support
Community Support

Hi @yve214 ,

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team _ kalyj

v-yanjiang-msft
Community Support
Community Support

Hi @yve214 ,

According to your description, please try this code:

Iterative Qty =
IF (
    HASONEVALUE ( date[date_dt] ),
    [final Qty],
    SUMX ( VALUES ( date[date_dt] ), [final Qty] )
)

Additionally, please see if this blog helps: Learn How to Fix Totals and Subtotals in DAX

 

Best Regards,
Community Support Team _ kalyj

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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