Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply

Measure to get cumulative total for months in the future from current month.

I have been trying to write a measure that can calculate the sum of a qty column based on date values in the past and in the future per month. The months should start from current month until the end which is always august.

planned dateqty
1/1/202212
1/2/202214
1/3/2022123
1/4/202266
1/5/202255
1/6/202255
1/7/202298
1/8/202223
1/9/202278
2/1/202245
2/2/202219
1/1/202376
2/1/202318
12/11/202373

 

The results I expect are,

DECJANFEBMARAPRMAYJUNJULAUG
518+523+16......

 

I've tried the SQLbi tutorial, but that doesn't seem to work, some assistance is greatly appreciated.

 

 

OutstandingAmountPerMonth = 
VAR LastVisibleDate =  
    MAX('Date'[Date])
VAR FirstVisibleDate = 
    MIN('Date'[Date])
VAR LastDateWithOutstanding = 
    CALCULATE(
        MAX(Sales_Line[Planned Shipment Date]),
        REMOVEFILTERS()
    )
VAR Result = 
    IF( FirstVisibleDate < LastDateWithOutstanding,
        CALCULATE( SUM( Sales_Line[Outstanding Amount]), 'Date'[Date] <= LastVisibleDate, Sales_Line[Type_(sales_order_assignment)] = BLANK() ) )
RETURN 
    Result

 

@amitchandak 

 

 

1 REPLY 1
v-xiaotang
Community Support
Community Support

Hi  @balaganeshmohan 

Thanks for reaching out to us.

It seems there is no relationship between sample data and expected output, so it is difficult to understand how your expected result is calculated. Theoretically, the cumulative total is the sum of the current month and the previous total. Please reshare your expected output, thanks

vxiaotang_0-1671010402559.png

 

 

Best Regards,

Community Support Team _Tang

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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