cancel
Showing results for
Did you mean:
cristianml Member

## Dax Measure IF

Hi,

I need to calculate a measure by following this logic:

if the column "Actual or Forecast" has or is equal to "Actual" then calculate the result if true (see below)

if the result is false then put the result if false (see below):

Result if true

CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Non-Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Capital Charges")+[Actual Cost Center]

Result if false

CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Non-Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Capital Charges")

I tried with something like this but it gives an error: IF('FT Forecast Q3','FT Forecast Q3'[Actual or Forecast]="Actual" then ........

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions Super User

## Re: Dax Measure IF

@cristianml seems like you had parenthesis at wrong place

```Forecast Q3 Cost = IF(MAX('FT Forecast Q3'[Actual or Forecast])="Actual",
CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Non-Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Capital Charges")+[Actual Cost Center],
CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Non-Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Capital Charges"))```

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs. 4 REPLIES 4 Super User

## Re: Dax Measure IF

@cristianml try this

`IF(MAX('FT Forecast Q3'[Actual or Forecast]="Actual" ), <true measure>, <false measure> )`

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs. cristianml Member

## Re: Dax Measure IF

Hi @parry2k ,

For some reason It doesn't work : Forecast Q3 Cost = IF(MAX('FT Forecast Q3'[Actual or Forecast]="Actual" ),
CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Non-Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Capital Charges")+[Actual Cost Center],
CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Non-Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Capital Charges"))

Regards, Super User

## Re: Dax Measure IF

@cristianml seems like you had parenthesis at wrong place

```Forecast Q3 Cost = IF(MAX('FT Forecast Q3'[Actual or Forecast])="Actual",
CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Non-Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Capital Charges")+[Actual Cost Center],
CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Non-Payroll")+CALCULATE(SUM('FT Forecast Q3'[Amount]),'FT Forecast Q3'[Category Group]="Capital Charges"))```

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs. cristianml Member

## Re: Dax Measure IF

Works perfect! Thanks!

Announcements #### New Topics Started Badges Coming  