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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
shahrukhgaffar0
Regular Visitor

Need Help with Dax in Report for cumulative One

Hi Data Expert,

I need Help to resolve an Issue Link of Report is Below for sample work.

I have Table which has Below Columns 

 

ProjectIDProjectNameCVR ValueCVR TypeCVR DateContract ValueProjectAwardDateCountry
P12ProjectA55,000Q130-Mar-202550,00002-Feb-2025Saudi
P12ProjectA58,000Q315-Aug-202550,00002-Feb-2025Saudi
P13ProjectB120,000Q325-Sep-2025100,00027-Aug-2025UAE
P13ProjectB125,000Q425-Dec-2025100,00027-Aug-2025UAE
P12ProjectA50,000Q425-Dec-202550,00002-Feb-2025Saudi



I Want Below Result

Month Cumulative Value Explanation

JanNo awards
Feb50,000Project A awarded (contract value 50,000)
Mar55,000Project A revised: CVR Q1 = 55,000
Apr55,000No changes
May55,000No changes
Jun55,000No changes
Jul55,000No changes
Aug158,000Project A (58,000) + Project B awarded (100,000)
Sep178,000Project B revised to 120,000 → 58,000 + 120,000
Oct178,000No changes
Nov178,000No changes
Dec175,000Project A revised to 50,000 + Project B revised to 125,000 = 175,000


You Can See Above as Example
I want this Result but i am not able to Achieve this 


shahrukhkhanbi/Power-BI-INC-Report

1 ACCEPTED SOLUTION
Praful_Potphode
Solution Sage
Solution Sage

Hi @shahrukhgaffar0 ,

try measure  below:

Cumulative Contract Value = 
VAR CurrentVisualDate = MAX( 'CalendarTable'[Date] )

RETURN
    SUMX(
        -- 1. Get ALL projects, ignoring the Month selection on the visual
        CALCULATETABLE(
            VALUES( 'Sales Data'[Opportunity ID] ),
            REMOVEFILTERS( 'CalendarTable' )
        ),

        -- 2. Define Project Context (Must also ignore Date filters to find the original Award Date)
        VAR ProjectAwardDate = CALCULATE( MAX( 'Sales Data'[Project Award Date] ), REMOVEFILTERS( 'CalendarTable' ) )
        VAR InitialContractValue = CALCULATE( SUM( 'Sales Data'[Contract Value] ), REMOVEFILTERS( 'CalendarTable' ) )

        -- 3. Find the LATEST Revision Date ON or BEFORE the visual date
        VAR LastRevisionDate = 
            CALCULATE(
                MAX( 'CVR_Events'[EventDate] ),
                'CVR_Events'[EventDate] <= CurrentVisualDate,
                REMOVEFILTERS( 'CalendarTable' ) 
            )

        -- 4. Retrieve the Value associated with that specific Revision Date
        VAR LastRevisionValue = 
            CALCULATE(
                SUM( 'CVR_Events'[EventValue] ),
                'CVR_Events'[EventDate] = LastRevisionDate,
                REMOVEFILTERS( 'CalendarTable' )
            )

        -- 5. Calculate Value (Only if the project is actually active)
        VAR CurrentValue = 
            SWITCH( TRUE(),
                -- Case A: Project hasn't started yet relative to visual date -> Show Nothing
                ProjectAwardDate > CurrentVisualDate || ISBLANK(ProjectAwardDate), BLANK(),

                -- Case B: There is a revision, and it happened on/after the award -> Use Revised Value
                NOT ISBLANK( LastRevisionDate ) && LastRevisionDate >= ProjectAwardDate, LastRevisionValue,

                -- Case C: Project is awarded, but no revisions yet -> Use Initial Value
                InitialContractValue
            )

        RETURN
            CurrentValue
    )

Praful_Potphode_0-1764933814393.png

Sample PBIX.

 

Please give kudos or mark it as solution once confirmed.

Thanks and Regards,

Praful

 

View solution in original post

4 REPLIES 4
Praful_Potphode
Solution Sage
Solution Sage

Hi @shahrukhgaffar0 ,

try measure  below:

Cumulative Contract Value = 
VAR CurrentVisualDate = MAX( 'CalendarTable'[Date] )

RETURN
    SUMX(
        -- 1. Get ALL projects, ignoring the Month selection on the visual
        CALCULATETABLE(
            VALUES( 'Sales Data'[Opportunity ID] ),
            REMOVEFILTERS( 'CalendarTable' )
        ),

        -- 2. Define Project Context (Must also ignore Date filters to find the original Award Date)
        VAR ProjectAwardDate = CALCULATE( MAX( 'Sales Data'[Project Award Date] ), REMOVEFILTERS( 'CalendarTable' ) )
        VAR InitialContractValue = CALCULATE( SUM( 'Sales Data'[Contract Value] ), REMOVEFILTERS( 'CalendarTable' ) )

        -- 3. Find the LATEST Revision Date ON or BEFORE the visual date
        VAR LastRevisionDate = 
            CALCULATE(
                MAX( 'CVR_Events'[EventDate] ),
                'CVR_Events'[EventDate] <= CurrentVisualDate,
                REMOVEFILTERS( 'CalendarTable' ) 
            )

        -- 4. Retrieve the Value associated with that specific Revision Date
        VAR LastRevisionValue = 
            CALCULATE(
                SUM( 'CVR_Events'[EventValue] ),
                'CVR_Events'[EventDate] = LastRevisionDate,
                REMOVEFILTERS( 'CalendarTable' )
            )

        -- 5. Calculate Value (Only if the project is actually active)
        VAR CurrentValue = 
            SWITCH( TRUE(),
                -- Case A: Project hasn't started yet relative to visual date -> Show Nothing
                ProjectAwardDate > CurrentVisualDate || ISBLANK(ProjectAwardDate), BLANK(),

                -- Case B: There is a revision, and it happened on/after the award -> Use Revised Value
                NOT ISBLANK( LastRevisionDate ) && LastRevisionDate >= ProjectAwardDate, LastRevisionValue,

                -- Case C: Project is awarded, but no revisions yet -> Use Initial Value
                InitialContractValue
            )

        RETURN
            CurrentValue
    )

Praful_Potphode_0-1764933814393.png

Sample PBIX.

 

Please give kudos or mark it as solution once confirmed.

Thanks and Regards,

Praful

 

amitchandak
Super User
Super User

@shahrukhgaffar0 , I am not sure why there is no change in the August value for project A 

P12 ProjectA 58,000 Q3 15-Aug-2025 50,000 02-Feb-2025 Saudi

 

Also, not able to find which is the first row. This one can not as this is having value 50,000

P12 ProjectA 55,000 Q1 30-Mar-2025 50,000 02-Feb-2025

 

Is there any other field to know the order of these lines. Also what is project end date 

My Idea was to have column that give valid till date 

Valid Till = COALESCE(Minx(filter('Table', [ProjectID] = EARLIER('Table'[ProjectID]) && [CVR Date] >= EARLIER([CVR Date])  || [CVR Date] >= EARLIER([ProjectAwardDate])), [CVR Date]), TODAY())
 
This not correct, because I am not able decide the fiest record and end date 
 
then I would used HR approch or allocation approch 
Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU
 
 
Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM
 
 
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

ProjectIDProjectNameCVR ValueCVR TypeCVR DateContract ValueProjectAwardDateCountry
P12ProjectA55,000Q130-Mar-2550,00002-Feb-25Saudi
P12ProjectA58,000Q315-Aug-2550,00002-Feb-25Saudi
P13ProjectB120,000Q325-Sep-25100,00027-Aug-25UAE
P13ProjectB125,000Q425-Dec-25100,00027-Aug-25UAE
P12ProjectA50,000Q425-Dec-2550,00002-Feb-25Saudi

 

What About this?

@shahrukhgaffar0 , I have created a new Sales2 table, Please check the power query steps, and then I created dax column and measure. I have not corrected GT, but every month value I got in the visual 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.