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
tahar1407
Frequent Visitor

Cumulative function

Hi all,

 

I'm trying to reproduce this Excel report : 

tahar1407_0-1627496253605.png

with those formula

tahar1407_1-1627496316548.pngtahar1407_2-1627496350707.png

For :

Estimated Freight

Add on 

Estimated Duty

Overhead           

Indirect Manufacturing 

Royalties

Payables & Purchases

Orders and Receivables

 

I added them in Power BI as measures.

 

The Net Balance is a Cumulative of all those Measures + $906590 

Total measure 1 = [Payables and Purchases 2] + [Orders and Receivables] + sum('Calendar'[Add on]) + sum('Calendar'[Indirect Manufacturing]) + SUM('Calendar'[Overhead]) + SUM('Calendar'[Royalties]) + [Estimated Duty] + [Estimated Duty] - 906590
tahar1407_3-1627496863854.png

 

and this is the cumulative measure :

tahar1407_4-1627496909295.png

 

but values are not the same between my Excel sheet and PowerBI:

tahar1407_5-1627497040765.png


maybe my formulas are wrong. I'm working on it since 2 days ago and I'm blocked. 

 

Any help, please 

@v-shex-msft 

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @tahar1407,

According to your description, it sounds like a common cumulative requirement across multiple fields.
If that is the case, I'd like to suggest you invoke an iterator function to looping on your tables.

Measure =
VAR currDate =
    MAX ( Calendar[Date] )
RETURN
    SUMX (
        FILTER ( ALLSELECTED ( 'Fact' ), 'Fact'[Date] <= currDate ),
        [column1] + [column2] + [Meaure1] + [Meaure1]
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi,

I need to start my cumulative total on a specific date/week
This is what I have now :

Cumulative Total Measure =
CALCULATE([Total measure 1],
FILTER(ALL('Calendar'),'Calendar'[Week 3] <= MAX('Calendar'[Week 3]) && 'Calendar'[Week 3] > DATE(2021,07,17)))
 
[Total measure 1] : is the total what all measures

as you can see, Total measure 1 it start with the date that I want but the cumulative start one week after
tahar1407_0-1627907446641.png

 

I have this Cumulative Measure :

Cumulative Total Measure = CALCULATE([Total measure 1],
FILTER(ALL('Calendar'),'Calendar'[Week 3] <= MAX('Calendar'[Week 3]) && 'Calendar'[Week 3] >= DATE(2021,07,17))
)
 
 
It works but at a moment it stopped working properly :
tahar1407_0-1627923706007.png

 as you can see, the Total Measure 1 is the total of all columns before 

the sum is correct but not the cumulative it should be 

($9,408,469)

the difference is 1445917 is the sum of 1250000 + 195917
 

Hi @tahar1407,

Any specific calculation for loop in raw measure expressions that you invoke? AFAIK, you can't directly apply multiple aggerations to measure expression or they will show the wrong reuslts. 

For this scenario, you can try to create a variable table with summarize function to apply the first aggregation and then use the iterator function to apply the second one.

Measure Totals, The Final Word 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.