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

Cumulative Daily Volume Measure in Power BI not working as expected

Hi I am trying to check how many product have been delivered day on day basis in cumulative order i.e. my graph would be in upward trend. So if on day 1 I have delivered 50 product and on day 2 I have delivered 31 product so on day 2 it should say 81 product.

 

New Daily Volume = 
CALCULATE(
    SUM(product[product_delivered]),
    FILTER(
        ALLSELECTED('product'),
        'product'[product_deliver_date] <= MAX('product'[product_deliver_date])
    )
)

 

I have created a new measure using above query and the above query works if there is only 1month selected in my Power BI chart. However if I select another month the line chart is not displaying correct result. For eg: Initially if I select 2023-10 and on 31st Oct, 2023 total product deliver would be 10000. Then upon selecting next month i.e. 2023-11 on 1st day if I deliver 122 product then it is showing 10122 and not 122 (shown in the below example).

 

Product_Deliver_Incorrect Chart.png

 

However the correct representation would be below chart

 

Product_Deliver_Correct Chart.png

 

Below image represent the number how it should be represent and how it is represented(Refer 2023-11(Incorrect)) column which is incorrect however I want data to be represented as column 2023-10(Correct) , 2023-11(Correct)

 

Excel.png

 

Sample Raw Data 

product_deliver_dateupdated_monthproduct_delivereddayofthemonth
11/1/20232023-1111
11/1/20232023-1111
11/2/20232023-1112
11/2/20232023-1112
11/2/20232023-1112
11/2/20232023-1112
10/3/20232023-1013
10/3/20232023-1013
11/3/20232023-1113
11/3/20232023-1113
11/3/20232023-1113
11/4/20232023-1114
11/4/20232023-1114
11/4/20232023-1114
11/4/20232023-1114
10/4/20232023-1014
10/4/20232023-1014
10/4/20232023-1014
11/3/20232023-1013

 

Can someone help me with this please? I am just starting to learn Power BI so kindly let me know how to resolve this? Any help would be appreciated. 

1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @Anonomous_user ,

I create a table as you mentioned.

vyilongmsft_0-1710925872937.png

It looks like you are trying to create a cumulative total measure in Power BI that resets at the start of each month. The issue you are encountering is due to the ALLSELECTED function, which does not reset the cumulative total when a new month is selected.

I think you can use REMOVEFILTERS to remove the filter context from the updated_month column, allowing the cumulative total to reset each month. 

 

Cumulative Product Delivered =
CALCULATE (
    SUM ( product[product_delivered] ),
    FILTER (
        ALL ( 'product'[product_deliver_date] ),
        'product'[product_deliver_date] <= MAX ( 'product'[product_deliver_date] )
    ),
    REMOVEFILTERS ( 'product'[updated_month] )
)

 

vyilongmsft_1-1710926118775.png

vyilongmsft_2-1710926537437.png

 

 

 

 

Best Regards

Yilong Zhou

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

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @Anonomous_user ,

I create a table as you mentioned.

vyilongmsft_0-1710925872937.png

It looks like you are trying to create a cumulative total measure in Power BI that resets at the start of each month. The issue you are encountering is due to the ALLSELECTED function, which does not reset the cumulative total when a new month is selected.

I think you can use REMOVEFILTERS to remove the filter context from the updated_month column, allowing the cumulative total to reset each month. 

 

Cumulative Product Delivered =
CALCULATE (
    SUM ( product[product_delivered] ),
    FILTER (
        ALL ( 'product'[product_deliver_date] ),
        'product'[product_deliver_date] <= MAX ( 'product'[product_deliver_date] )
    ),
    REMOVEFILTERS ( 'product'[updated_month] )
)

 

vyilongmsft_1-1710926118775.png

vyilongmsft_2-1710926537437.png

 

 

 

 

Best Regards

Yilong Zhou

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

Anonomous_user
Frequent Visitor

Hello Everyone,

 

Can anyone help me on this issue I have been stuck from past 2 days on this. Little bit urgent from my end. Any help would be aprreciated.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.