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

Sum of cumulative inventory / sum of measure

Hi!

 

At the moment my matrix looks like this (tammikuu = january):

kuva.png

Column 1 shows the values that my fact table has (Inventory changes).

Column 2 is a cumulative measure of those changes:

 

2 = CALCULATE (
    SUM ( Fact[value]);
    FILTER (
        ALL (CalendarTable[Date]);
        CalendarTable[Date] <= MAX ( Fact[date] )
    )
)

And column 3 is the problematic one.

Basically I have 2 questions/problems:

 

1. At the moment every row that doesnt have a cumulative value is shown as 0, but I would like it to be as follows:

 

1.1.20178267182671
2.1.2017 82671
3.1.2017 82671
4.1.2017 82671
5.1.2017 82671
6.1.2017 82671
7.1.2017 82671
8.1.2017 82671
9.1.2017-2112561546
10.1.2017 61546
11.1.2017-1681844728
12.1.2017 44728
13.1.2017 44728
14.1.2017 44728
15.1.2017 44728
16.1.2017 44728
17.1.2017 44728
18.1.2017 44728
19.1.2017 44728
20.1.2017 44728
21.1.2017 44728
22.1.2017 44728
23.1.2017 44728
24.1.2017-44333395
25.1.2017 395
26.1.2017 395
27.1.2017 395
28.1.2017 395
29.1.2017 395
30.1.2017 395
31.1.2017 395

 

2. I also need a sum of the third column (in this case 1369084) because in the end I want to calculate the average of the month (1369084/31).

 

All help and tips are much appreciated!

1 ACCEPTED SOLUTION

@mikaro

 

In this scenario, you can add a calculated column to return same result as @Vvelarde's approach.

 

Column =
CALCULATE (
    SUM ( Table2[value] ),
    FILTER ( Table2, Table2[Date] <= EARLIER ( Table2[Date] ) )
)

78.PNG

 

 

Then you can sum those values properly.

View solution in original post

3 REPLIES 3
Vvelarde
Community Champion
Community Champion

@mikaro

 

hi, Point 1:

 

Running total =
CALCULATE (
    SUM ( 'Table2'[Value] );
    ALLSELECTED ( Table2[Value] );
    FILTER (
        ALLSELECTED ( 'Table2'[Date] );
        ISONORAFTER ( 'Table2'[Date]; MAX ( 'Table2'[Date] ); DESC )
    )
)

 

Running.png 




Lima - Peru

Thanks @Vvelarde!

 

How about the second question? Any ideas on that?

@mikaro

 

In this scenario, you can add a calculated column to return same result as @Vvelarde's approach.

 

Column =
CALCULATE (
    SUM ( Table2[value] ),
    FILTER ( Table2, Table2[Date] <= EARLIER ( Table2[Date] ) )
)

78.PNG

 

 

Then you can sum those values properly.

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.