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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Calculated Measure not working

Hello,


I am trying to replicate an excel formula into dax measure but it is not understanding the rules, can you help me with this?

 

Original:

Formula: =SE(E8<0;(D9+E8);D9)

cqueiroz2222_0-1731328637758.png

 PBI:

Dax: 

CC_Resultado =
VAR vCurrent = [Result]
VAR vPrevious = CALCULATE([Result], PREVIOUSMONTH(dim_Calendario[Data]))

RETURN
    IF(
        vPrevious < 0,
            vCurrent + vPrevious,
                vCurrent)

cqueiroz2222_1-1731328659479.png

 

How can I star with "0" as in line above in the excel?

 

The main idea is: when Last Month's Result be positive: replicate current month result

When last month be negative: acumulate the result with last month (current month + last month)

Status: Investigating
Comments
Anonymous
Not applicable

Hi @cqueiroz2222 ,

 

Try the following expression:

CC_Resultado =
VAR vCurrent = [Result]
VAR vPrevious = CALCULATE([Result], PREVIOUSMONTH(dim_Calendario[Data]))
VAR vStart = IF(ISBLANK(vPrevious), 0, vPrevious)

RETURN
    IF(
        vStart < 0,
            vCurrent + vStart,
                vCurrent)

 

Best regards,
Community Support Team_ Scott Chang

cqueiroz2222
Helper I

Hello @Anonymous,

 

It didn't work, the idea of replicate [Result] is only when C/C last month (or line above) is positive, is it possible?

 

Please, see the example in the original version:

cqueiroz2222_0-1731417473502.png