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
Anonymous
Not applicable

Cumulative Sum of qty based on multiple dates (forecast plan date and forecast date)

Hello,

Need some help or guidance to fix the problem on dax that is expected to return the Cumulative sum of qty

The cumulative measure works the report is filtered to one forecast plan date and one product.. 

 

Let me know if you need any detials.. 

 

 

 

 

Total Fcst_Qty = CALCULATE(Sum('Forecast-Cumulative'[Qty]),ALLSELECTED('Forecast-Cumulative'))

Cumulative Fcst_Qty = CALCULATE([Total Fcst_Qty],FILTER(ALLSELECTED('Forecast-Cumulative'),'Forecast-Cumulative'[fcstDate]<=MAX('Forecast-Cumulative'[fcstDate])))

 

 

 

 

The measure seems to be working when the report is filtered to one product and one Forecast plan date .The measure seems to be working when the report is filtered to one product and one Forecast plan date .

 

Out put of cumulative measure in correct as the value is same across all the dates and productsOut put of cumulative measure in correct as the value is same across all the dates and products

 

 

 

 

 

 

 

Dataset columns and its relationshipDataset columns and its relationship

 

Below is the sample data.. due to restiction to post not more than 20k size i have added the sample data of one Forecast plan date..  

 

fcstplandateVendorProduct-PartfcstDateQty
8/6/2021Vendor-1Product-Part-18/9/2021207
8/6/2021Vendor-2Product-Part-28/9/2021357
8/6/2021Vendor-1Product-Part-18/16/2021288
8/6/2021Vendor-2Product-Part-28/16/202121
8/6/2021Vendor-1Product-Part-18/23/2021286
8/6/2021Vendor-2Product-Part-28/23/202121
8/6/2021Vendor-1Product-Part-18/30/2021282
8/6/2021Vendor-2Product-Part-28/30/202121
8/6/2021Vendor-1Product-Part-19/6/2021280
8/6/2021Vendor-2Product-Part-29/6/202121
8/6/2021Vendor-1Product-Part-19/13/2021276
8/6/2021Vendor-2Product-Part-29/13/202120
8/6/2021Vendor-1Product-Part-19/20/2021272
8/6/2021Vendor-2Product-Part-29/20/202119
8/6/2021Vendor-1Product-Part-19/27/2021270
8/6/2021Vendor-2Product-Part-29/27/202119
8/6/2021Vendor-1Product-Part-110/4/2021266
8/6/2021Vendor-2Product-Part-210/4/202119
8/6/2021Vendor-1Product-Part-110/11/2021262
8/6/2021Vendor-2Product-Part-210/11/202118
8/6/2021Vendor-1Product-Part-110/18/2021260
8/6/2021Vendor-2Product-Part-210/18/202118
8/6/2021Vendor-1Product-Part-110/25/2021256
8/6/2021Vendor-2Product-Part-210/25/202116
8/6/2021Vendor-1Product-Part-111/1/2021253
8/6/2021Vendor-2Product-Part-211/1/202116
8/6/2021Vendor-1Product-Part-111/8/2021250
8/6/2021Vendor-2Product-Part-211/8/202116
8/6/2021Vendor-1Product-Part-111/15/2021247
8/6/2021Vendor-2Product-Part-211/15/202116
8/6/2021Vendor-1Product-Part-111/22/2021243
8/6/2021Vendor-2Product-Part-211/22/202116
8/6/2021Vendor-1Product-Part-111/29/2021240
8/6/2021Vendor-2Product-Part-211/29/202116
8/6/2021Vendor-1Product-Part-112/6/2021237
8/6/2021Vendor-2Product-Part-212/6/202115
8/6/2021Vendor-1Product-Part-112/13/2021234
8/6/2021Vendor-2Product-Part-212/13/202115
8/6/2021Vendor-1Product-Part-112/20/2021231
8/6/2021Vendor-2Product-Part-212/20/202115
8/6/2021Vendor-1Product-Part-112/27/2021228
8/6/2021Vendor-2Product-Part-212/27/202115
8/6/2021Vendor-1Product-Part-11/3/2022225
8/6/2021Vendor-2Product-Part-21/3/202214
8/6/2021Vendor-1Product-Part-11/10/2022222
8/6/2021Vendor-2Product-Part-21/10/202214
8/6/2021Vendor-1Product-Part-11/17/2022220
8/6/2021Vendor-2Product-Part-21/17/202213
8/6/2021Vendor-1Product-Part-11/24/2022217
8/6/2021Vendor-2Product-Part-21/24/202214
8/6/2021Vendor-1Product-Part-11/31/2022215
8/6/2021Vendor-2Product-Part-21/31/202213
8/6/2021Vendor-1Product-Part-12/7/2022212
8/6/2021Vendor-2Product-Part-22/7/202214
8/6/2021Vendor-1Product-Part-12/14/2022210
8/6/2021Vendor-2Product-Part-22/14/202212
8/6/2021Vendor-1Product-Part-12/21/2022207
8/6/2021Vendor-2Product-Part-22/21/202212
8/6/2021Vendor-1Product-Part-12/28/2022204
8/6/2021Vendor-2Product-Part-22/28/202212
8/6/2021Vendor-1Product-Part-13/7/2022201
8/6/2021Vendor-2Product-Part-23/7/202212
8/6/2021Vendor-1Product-Part-13/14/2022199
8/6/2021Vendor-2Product-Part-23/14/202212
8/6/2021Vendor-1Product-Part-13/21/2022196
8/6/2021Vendor-2Product-Part-23/21/202211
8/6/2021Vendor-1Product-Part-13/28/2022192
8/6/2021Vendor-2Product-Part-23/28/202211
8/6/2021Vendor-1Product-Part-14/4/2022191
8/6/2021Vendor-2Product-Part-24/4/202211
8/6/2021Vendor-1Product-Part-14/11/2022187
8/6/2021Vendor-2Product-Part-24/11/202211
8/6/2021Vendor-1Product-Part-14/18/2022185
8/6/2021Vendor-2Product-Part-24/18/202211
8/6/2021Vendor-1Product-Part-14/25/2022180
8/6/2021Vendor-2Product-Part-24/25/202210
8/6/2021Vendor-1Product-Part-15/2/2022179
8/6/2021Vendor-2Product-Part-25/2/202210
8/6/2021Vendor-1Product-Part-15/9/2022176
8/6/2021Vendor-2Product-Part-25/9/202210
8/6/2021Vendor-1Product-Part-15/16/2022173
8/6/2021Vendor-2Product-Part-25/16/202210
8/6/2021Vendor-1Product-Part-15/23/2022169
8/6/2021Vendor-2Product-Part-25/23/202210
8/6/2021Vendor-1Product-Part-15/30/2022166
8/6/2021Vendor-2Product-Part-25/30/202210
8/6/2021Vendor-1Product-Part-16/6/2022163
8/6/2021Vendor-2Product-Part-26/6/20229
8/6/2021Vendor-1Product-Part-16/13/2022161
8/6/2021Vendor-2Product-Part-26/13/20224
8/6/2021Vendor-1Product-Part-16/20/2022157
8/6/2021Vendor-2Product-Part-26/20/20224
8/6/2021Vendor-1Product-Part-16/27/2022155
8/6/2021Vendor-2Product-Part-26/27/20224
8/6/2021Vendor-1Product-Part-17/4/2022151
8/6/2021Vendor-2Product-Part-27/4/20224
8/6/2021Vendor-1Product-Part-17/11/2022147
8/6/2021Vendor-2Product-Part-27/11/20224
8/6/2021Vendor-1Product-Part-17/18/2022145
8/6/2021Vendor-2Product-Part-27/18/20224
8/6/2021Vendor-1Product-Part-17/25/2022141
8/6/2021Vendor-2Product-Part-27/25/20224
2 REPLIES 2
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Can you clarify your use of ALLSELECTED here?

I would've thought you should be using simply:

Total Fcst_Qty =
CALCULATE ( SUM ( 'Forecast-Cumulative'[Qty] ), 'Forecast-Cumulative' )

Cumulative Fcst_Qty =
CALCULATE (
    [Total Fcst_Qty],
    FILTER (
        ALLEXCEPT ( 'Forecast-Cumulative', 'Forecast-Cumulative'[Product-Part] ),
        'Forecast-Cumulative'[fcstDate] <= MAX ( 'Forecast-Cumulative'[fcstDate] )
    )
)

Regards

Anonymous
Not applicable

 

Thank you @Jos_Woolley for your response.
Use of Allselected was to make sure that the cumulative is calulated for selected values from the slicers or matrix..

I made measure changes as per your suggestion but looks like the cumulative is not getting filtered for the fcstdate against the respective fcstplandate.
For example in the below snip the 08/09/2021 fcstdate & 08/07/2021 fcstplandate,  the qty is 357 but the cumulative is calculated as sum of all 08/09/2021 fcstdate and not considering any filters in the report.

image.png

 

 

Thanks in advance!

 

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.