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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Suhel_Ansari
Helper IV
Helper IV

Cumulative Sum less then Current Date

Hi All,

I need the Cumulative Sum measure for the column based on the less then Current Date which means I want to add the colum "ST_Day_Duration" provided the Contract End Date is less then Today() as seen in the foolowing screen print. I want to Sum the ST_Day_Duration column for India except the contract Date less then today.

Suhel_Ansari_0-1671118021990.png

Similarly I want to sum the USA except the contract Date less then today.

Suhel_Ansari_1-1671118148447.png

Please assist with the Mesure or column.

Thanks

Suhel

 

1 ACCEPTED SOLUTION

Hi @Suhel_Ansari 

 

Create a measure:

Measure = 
IF (
    MAX('Table'[Contract end date]) <= TODAY (),
    CALCULATE (
        SUM ( 'Table'[ST_Day_Duration] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Contract end date] <= TODAY ()
                && 'Table'[Country] = SELECTEDVALUE( 'Table'[Country] )
        )
    )
)

 

vyadongfmsft_0-1671180173278.png

Best regards,

Yadong Fang

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

7 REPLIES 7
v-yadongf-msft
Community Support
Community Support

Hi @Suhel_Ansari ,

 

Please try:

Column = 
IF (
    'Table'[Contract end date] <= TODAY (),
    CALCULATE (
        SUM ( 'Table'[ST_Day_Duration] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Contract end date] <= TODAY () )
    )
)

vyadongfmsft_0-1671173163355.png

 

Best regards,

Yadong Fang

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

hi @v-yadongf-msft ,

It a partial answer I am getting wrong answer if i have more Country as seen in the attached screen print and moreover I need a Measure please assit. Thanks

Suhel_Ansari_0-1671174089760.png

 Regards

Suhel

Hi @Suhel_Ansari 

 

Create a measure:

Measure = 
IF (
    MAX('Table'[Contract end date]) <= TODAY (),
    CALCULATE (
        SUM ( 'Table'[ST_Day_Duration] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Contract end date] <= TODAY ()
                && 'Table'[Country] = SELECTEDVALUE( 'Table'[Country] )
        )
    )
)

 

vyadongfmsft_0-1671180173278.png

Best regards,

Yadong Fang

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

Hi @v-yadongf-msft  , 
Thank you for the prompt respone, I need to cretae a another Measure to get the "Max - ST_Day_Duration" for the Future date for Example as seen in the following screen print, for India the future date is "5/18/2026" and the value should be "210.3903" similarly for USA the date is "10/6/2025" and the value should be "69.3903", please assist. Thanks🙏

 

Suhel_Ansari_0-1671187765083.png

Regards

Suhel

v-yadongf-msft
Community Support
Community Support

Hi @Suhel_Ansari ,

 

In order to better understanding your demands and give the right solution, could you please tell me what's your expected output?

 

Thanks for your efforts & time in advance.

 

Best regards,

Yadong Fang

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

Hi @v-yadongf-msft ,
I want the Cumulative Sum for all the row for the "ST_Day_Duration" for a given Country provided the Contract End Date is less then Today() Date. Exmaple for the country INDIA i want to sum the (16.9389+7.0278+20.916) = 44.8827 Rows, Except the first Row whos Contract End Date is "5/18/2026".

Suhel_Ansari_2-1671164767775.png

Regards

Suhel

Suhel_Ansari
Helper IV
Helper IV

@amitchandak  , @Greg_Deckler , @parry2k  , please asssit. Thanks

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.