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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
lboldrino
Resolver I
Resolver I

Cumulative Revenue by Plan

Hier ist the Request:

if month > Current month -> Actaul Value else plan Value

 
How can i write my code correct to have a cumulative value about this Request:

 

 

Cumulative Umsatz = 
var _value = month([Current Day])
var _year = SELECTEDVALUE(dim_opportunity[DeliveryDate].[Year])
var _mon = SELECTEDVALUE(dim_opportunity[DeliveryDate].[MonthNo])
var _umsatz =  if(_mon < _value,[Umsatz  ProfitCenter],sum(dim_opportunity[Weighted Position]))

Return CALCULATE(_umsatz,
             dim_opportunity[DeliveryDate].[Year]= _year,
        dim_opportunity[DeliveryDate].[Date] <= MAX(dim_opportunity[DeliveryDate].[Date]))

 

here is my code, but not correct 😞

thnx

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @lboldrino ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create the following measures to get the culmulative values:

ActualPlan = 
VAR _curmonth =
    MONTH ( TODAY () )
VAR _selmonth =
    SELECTEDVALUE ( dim_opportunity[DeliveryDate].[MonthNo] )
VAR _values =
    IF (
        _selmonth < _curmonth,
        CALCULATE ( SUM ( 'dim_opportunity'[Umsatz ProfitCenter] ) ),
        CALCULATE ( SUM ( 'dim_opportunity'[Weighted Position] ) )
    )
RETURN
    _values
Temp = 
SUMX (
    FILTER (
        ALLSELECTED ( 'dim_opportunity' ),
        'dim_opportunity'[ProfitCenter]
            = SELECTEDVALUE ( 'dim_opportunity'[ProfitCenter] )
            && 'dim_opportunity'[DeliveryDate].[Year]
                = SELECTEDVALUE ( 'dim_opportunity'[DeliveryDate].[Year] )
            && 'dim_opportunity'[DeliveryDate].[MonthNo]
                <= SELECTEDVALUE ( 'dim_opportunity'[DeliveryDate].[MonthNo] )
    ),
    [ActualPlan]
)
Cumulative Umsatz = SUMX ( VALUES ( dim_opportunity[ProfitCenter] ), [Temp] )

yingyinr_0-1649151705721.png

If the above one can't help you get the desired result, please provide some sample data with Text format(exclude sensitive data) and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi  @lboldrino ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create the following measures to get the culmulative values:

ActualPlan = 
VAR _curmonth =
    MONTH ( TODAY () )
VAR _selmonth =
    SELECTEDVALUE ( dim_opportunity[DeliveryDate].[MonthNo] )
VAR _values =
    IF (
        _selmonth < _curmonth,
        CALCULATE ( SUM ( 'dim_opportunity'[Umsatz ProfitCenter] ) ),
        CALCULATE ( SUM ( 'dim_opportunity'[Weighted Position] ) )
    )
RETURN
    _values
Temp = 
SUMX (
    FILTER (
        ALLSELECTED ( 'dim_opportunity' ),
        'dim_opportunity'[ProfitCenter]
            = SELECTEDVALUE ( 'dim_opportunity'[ProfitCenter] )
            && 'dim_opportunity'[DeliveryDate].[Year]
                = SELECTEDVALUE ( 'dim_opportunity'[DeliveryDate].[Year] )
            && 'dim_opportunity'[DeliveryDate].[MonthNo]
                <= SELECTEDVALUE ( 'dim_opportunity'[DeliveryDate].[MonthNo] )
    ),
    [ActualPlan]
)
Cumulative Umsatz = SUMX ( VALUES ( dim_opportunity[ProfitCenter] ), [Temp] )

yingyinr_0-1649151705721.png

If the above one can't help you get the desired result, please provide some sample data with Text format(exclude sensitive data) and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

How to upload PBI in Community

Best Regards

lboldrino
Resolver I
Resolver I

here is my Mesaure

 

Umsatz_ProfitCenter = 
var _value = month([Current Day])
var _year = SELECTEDVALUE(dim_opportunity[DeliveryDate].[Year])
var _mon = SELECTEDVALUE(dim_opportunity[DeliveryDate].[MonthNo])
var _pc = SELECTEDVALUE(dim_opportunity[ProfitCenter])

Return 

if(_mon < _value,
CALCULATE(sum(dim_Buchungen[Actual Saldo]), dim_Buchungen[Profit-Center Nummer]= _pc && dim_Buchungen[Buchungsperiode Nummer]= _mon && dim_Buchungen[Geschäftsjahr Nummer] = _year),sum(dim_opportunity[Weighted Position])

)

 

 

and my CumSum:

 

Cumulative Umsatz = 
    CALCULATE(SUMX(values(dim_opportunity[DeliveryDate].[Year]) , 
        [Umsatz_ProfitCenter]),
       filter(allselected(dim_opportunity[DeliveryDate]),
       dim_opportunity[DeliveryDate] <= max(dim_opportunity[DeliveryDate])))

 

 

Result:

lboldrino_1-1648806306522.png

 

its not Cumulativ (by profitCenters) and i have no total over month my measure 😞

 

amitchandak
Super User
Super User

@lboldrino , Assume actual and plan are measures try a measure like

 

Cumm Sales = CALCULATE(SUMX(values('Date'[Month Year]) , if(max('Date'[date]) >= eomonth(today(),0) ,[plan], [actual])),filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

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

dont work 😞

 

Cumulative Umsatz = 
var _value = month([Current Day])
var _year = SELECTEDVALUE(dim_opportunity[DeliveryDate].[Year])
var _mon = SELECTEDVALUE(dim_opportunity[DeliveryDate].[MonthNo])

Return 
        CALCULATE(SUMX(values(dim_opportunity[DeliveryDate].[Year]) , 
        [Umsatz_ProfitCenter]),
       filter(allselected(dim_opportunity[DeliveryDate]),
       dim_opportunity[DeliveryDate] <= max(dim_opportunity[DeliveryDate])))

 

 

 

How can i cumulative sum by measure [Umsatz_ProfitCenter]

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.