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
kolturra
Helper IV
Helper IV

Cummulative SUM DAX ERROR

Hi,

 

I have issue DAX fomula with running total. I have done running total calculation in column F, what i have identify that my DAX formula is not populating same like manual calculation. Difference of running total i kept in column G.

help me understand where is the problem in my DAX.

 

I have updated excel file in below link

https://onedrive.live.com/embed?cid=B6A84FD93EE33256&resid=B6A84FD93EE33256%2120824&authkey=AEbwMccj...

 

Below is the formula, i am using to get running total.

RunningTotal = CALCULATE(SUM(a[Energy]),FILTER(a,a[NewDay]<=EARLIER(a[NewDay])&&a[TimeFactor]<=EARLIER(a[TimeFactor])))
 
Thanks,
K Raghavender Rao
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Sorry about that.  Try this one:

Column = 
var __CurrentCreatedTime = Table2[CreatedTime]
RETURN

CALCULATE(
    SUM( Table2[Energy] ),
    FILTER( 
        ALL( Table2 ),
        __CurrentCreatedTime >= Table2[CreatedTime]
    )
)

Did a check, and looks like the new column is what you would want:

Calc Column Check.png

Also, be sure to set your data types in Power Query. 

Set Data Types.png

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

try this code for a calculated column:

Column = 
var __CurrentDay = Table2[NewDay]
var __CurrentTime= Table2[TimeFactor]

RETURN

CALCULATE(
    SUM( Table2[Energy] ),
    FILTER( 
        ALL( Table2 ),
        __CurrentDay >= Table2[NewDay]
        && __CurrentTime >= Table2[TimeFactor]
    )
)

Hi @Anonymous ,

 

Thanks for your reply.

 

Whatever DAX which you have shared and i have created are showing same results but both the DAX fomulas shows same errors at one place. Below screenshot for your reference. Can you plesae help me on this.

 

DAX Error.PNG

 

 

 

 

 

 

 

 

Thanks,

K Raghavender Rao

Anonymous
Not applicable

Sorry about that.  Try this one:

Column = 
var __CurrentCreatedTime = Table2[CreatedTime]
RETURN

CALCULATE(
    SUM( Table2[Energy] ),
    FILTER( 
        ALL( Table2 ),
        __CurrentCreatedTime >= Table2[CreatedTime]
    )
)

Did a check, and looks like the new column is what you would want:

Calc Column Check.png

Also, be sure to set your data types in Power Query. 

Set Data Types.png

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.