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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Snagalapur
Helper IV
Helper IV

Periodic Cumulative phasing

Hi All,

 

Kindly suggest how to modify below measure to show cumulative values ie.. P01 = P01, P02 = P01 +P02, P03 = P01 +P02+P03

 

Budget PNL =

VAR LC=

CALCULATE(SUM(FACT_DATA[AMOUNT]), FILTER(FACT_DATA, [CURRENCY_ID]=186 && FACT_DATA [SCENARIO_ID]=2 && year(FACT_DATA [PERIOD_DATE])=[ControlPeriod Current Year]))

 

VAR USD=

CALCULATE(SUM(FACT_DATA[AMOUNT]), FILTER(FACT_DATA, [CURRENCY_ID]=184 && FACT_DATA [SCENARIO_ID]=2&& year(FACT_DATA[PERIOD_DATE])=[ControlPeriod Current Year]))

 

RETURN

IF(SELECTEDVALUE(_Currency[Currency])="Local",LC,

IF(SELECTEDVALUE(_Currency[Currency])="USD Operational",USD))

 

ControlPeriod Current Year = YEAR(ALL(DIM_CONTROL_PERIOD[CURRENT_PERIOD]))

my model looks like: 

Snagalapur_0-1771345149656.png

 

Snagalapur_2-1771345184711.png

Snagalapur_0-1771351414831.png

 

 

Snagalapur_0-1771350295279.pngSnagalapur_1-1771350338762.png

 

Snagalapur_5-1771345201092.png

 

 

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Snagalapur , If they in the same format they are sortable. You can use visual calculation running sum 

Visual Calculations in Power BI- February 2024 Update RUNNINGSUM, RANGE, MOVINGAVERAGE, COLLAPSE, COLLAPSEALL, EXPAND, EXPANDALL, FIRST, LAST, PREVIOUS, and NEXT
https://www.youtube.com/watch?v=bKD9T0EWgQo&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L

Else have Rank column in your table on YYYYPP (Year period )

Period Rank = RANKX(all(Period),Period[year period],,ASC,Dense)

Then you can measure 
Cumm =  CALCULATE(sum('Table'[Qty]), FILTER(ALL(Period),Period[Period Rank]<=max(Period[Period Rank])))

Also other measures 

This Period = CALCULATE(sum('Table'[Qty]), FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])))
Last Period = CALCULATE(sum('Table'[Qty]), FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])-1))


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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Snagalapur , If they in the same format they are sortable. You can use visual calculation running sum 

Visual Calculations in Power BI- February 2024 Update RUNNINGSUM, RANGE, MOVINGAVERAGE, COLLAPSE, COLLAPSEALL, EXPAND, EXPANDALL, FIRST, LAST, PREVIOUS, and NEXT
https://www.youtube.com/watch?v=bKD9T0EWgQo&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L

Else have Rank column in your table on YYYYPP (Year period )

Period Rank = RANKX(all(Period),Period[year period],,ASC,Dense)

Then you can measure 
Cumm =  CALCULATE(sum('Table'[Qty]), FILTER(ALL(Period),Period[Period Rank]<=max(Period[Period Rank])))

Also other measures 

This Period = CALCULATE(sum('Table'[Qty]), FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])))
Last Period = CALCULATE(sum('Table'[Qty]), FILTER(ALL(Period),Period[Period Rank]=max(Period[Period Rank])-1))


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

Thank you for your time. 

 

I used below sample code to modify and this works 

Cumulative Sales = 
VAR MaxDate = MAX('DateTable'[Date])
RETURN
CALCULATE(
    SUM('Sales'[Amount]),
    FILTER(
        ALLSELECTED('DateTable'),
        'DateTable'[Date] <= MaxDate
    )
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

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.