Simple If command not working

Anything related to PowerPivot and DAX Formuale
Frank
Posts: 31
Joined: Wed Jul 13, 2016 8:31 am

Simple If command not working

Postby Frank » Sat Apr 22, 2017 11:10 am

I have a simple Fact table that has a column Fact_Required with "Y" in some rows. I would like to run a specific measure if the value in Fact_Required = Y and another if it is blank or 0.
I tried using the following but get an error:

Monthly Dividend_2:=if(FactData[Factor_Required]="Y",[Monthly Dividend],
[Monthly Dividend_1])).

Appreciate any help or advise.

Thanks

Frank

MattAllington
Posts: 881
Joined: Sun May 04, 2014 4:01 pm
Location: Sydney, Australia

Re: Simple If command not working

Postby MattAllington » Sun Apr 23, 2017 7:27 am

You have 1 too many close brackets
Matt Allington is Professional Self Service BI Consultant, Trainer and Author of the book "Learn to Write DAX". You can hire me at http://Exceleratorbi.com.au
http://exceleratorbi.com.au/what-is-power-pivot/
http://xbi.com.au/learndax

Frank
Posts: 31
Joined: Wed Jul 13, 2016 8:31 am

Re: Simple If command not working

Postby Frank » Tue May 02, 2017 8:10 am

Thanks Matt. The actual measure had the correct brackets. The problem turned out to have something to do with the Data Type of the "Factor Required_column". I had made sure it was text but never got it to correctly recognize the "Y" character. Once I changed it to Data Type Decimal Number and used 1 instead of "Y" it all worked fine.

Thanks again

Frank


Return to “PowerPivot/DAX”

Who is online

Users browsing this forum: No registered users and 1 guest