Forum Discussion

rfernandez's avatar
rfernandez
Regular Visitor
7 years ago
Solved

Cumulative graph

Hi,
I have this data 

TypePoRAmountMonth
AReal51
AReal42
AReal53
AReal84
AReal95
APlan21
APlan32
APlan63
APlan34
APlan75
BReal61
BReal72
BReal73
BReal74
BReal105
BPlan51
BPlan52
BPlan73
BPlan84
BPlan85

 

and im trying to create the following graph, that is a cumulative graph for type A and B (real-plan) for each month 



Thanks

  • Hi rfernandez,

     

    You can achieve this by creating the following measures:

     

    Real-Plan = 
    CALCULATE ( SUM ( Plan[Amount] ); Plan[PoR] = "Real" )
        - CALCULATE ( SUM ( Plan[Amount] ); Plan[PoR] = "Plan" )
    
    
    
    
    Cumulative =
    CALCULATE (
        SUMX ( Plan; [Real-Plan] );
        FILTER ( ALLSELECTED ( Plan[Month] ); Plan[Month] <= MAX ( Plan[Month] ) )
    )

    Then just use your cumulative measure on your charts.

     

    Although the ansewer by AnkitBI is good, a good practice is to create a measure instead of calculated columns since they add size to your model and complexity.

     

    This option works both for PBI and for Excel PowerPivot see attach both files with the solutions.

     

    Regards,

    MFelix

     

     

3 Replies

  • Hi rfernandez,

     

    You can achieve this by creating the following measures:

     

    Real-Plan = 
    CALCULATE ( SUM ( Plan[Amount] ); Plan[PoR] = "Real" )
        - CALCULATE ( SUM ( Plan[Amount] ); Plan[PoR] = "Plan" )
    
    
    
    
    Cumulative =
    CALCULATE (
        SUMX ( Plan; [Real-Plan] );
        FILTER ( ALLSELECTED ( Plan[Month] ); Plan[Month] <= MAX ( Plan[Month] ) )
    )

    Then just use your cumulative measure on your charts.

     

    Although the ansewer by AnkitBI is good, a good practice is to create a measure instead of calculated columns since they add size to your model and complexity.

     

    This option works both for PBI and for Excel PowerPivot see attach both files with the solutions.

     

    Regards,

    MFelix

     

     

  • AnkitBI's avatar
    AnkitBI
    Solution Sage

    Please find the PBIX PBIX. Hope this Helps. I am using Power Query to  get first 3 Output columns and a Calculated Column to get comulative value.