cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cristianml Member
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
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")
)





Did I answer your question? Mark my post as a solution.

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





View solution in original post

4 REPLIES 4
Super User
Super User

Re: Dax Measure IF

@cristianml try this

 

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





Did I answer your question? Mark my post as a solution.

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





cristianml Member
Member

Re: Dax Measure IF

Hi @parry2k ,

 

For some reason It doesn't work :

 

 

Error.jpg

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
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")
)





Did I answer your question? Mark my post as a solution.

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





View solution in original post

cristianml Member
Member

Re: Dax Measure IF

@parry2k ,

 

Works perfect! Thanks! 

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)