- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

# Nested If / And statement not working

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-13-2019 01:11 AM

Hi All,

I know, this is something relatively easy, but i cannot figure out my issues with this DAX . Below is my scenario..

I have Sales measure which gives me total sales of selected year in Slicer.

I also have Previous year sales measure which gives me Last year sales.

Based on that, I am calcuating growth rate, which is also in another measure.

My growth rate formula look like,

DIVIDE('Measure Dimension for Product'[Measure Selection for Product]-[Last Year],[Last Year])

format is Percentage..

Now, i am segemnting this growth rate by different category like 1,2,3

for example,

if the growth rate is 0 to 25 , then 1

if the growth rate is 26 to 50 , then 2

if the growth rate is greater than 100,3

else,0

for that, logic i have written below formula,

Does not work.. It gives me only 1 or 0.. when growth rate is also 26

to 50.. It shows also 1.

I have tried with Switch statement also,

Solved! Go to Solution.

Accepted Solutions

## Re: Nested If / And statement not working

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-13-2019 01:34 AM

Hi @snandy2011

It could be that your measure is yielding results different from what you expect.

In any case, try using 0,25 instead of 25, 0,50 instead of 50, etc. Those are the real values of your division even though you are formatting them as percentage.

All Replies

## Re: Nested If / And statement not working

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-13-2019 01:34 AM

Hi @snandy2011

It could be that your measure is yielding results different from what you expect.

In any case, try using 0,25 instead of 25, 0,50 instead of 50, etc. Those are the real values of your division even though you are formatting them as percentage.

## Re: Nested If / And statement not working

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-13-2019 03:49 AM

Seems you meant to categorize a percentage, .e.g. 0-25% , 25%-50%.

Your formula checks integer values, not percentages.

On the other hand, your formula does not include values above 50 which may be the case that actual values are above 50 (or 50%) and is not recognized, so the formula returns 0

Can you provide a sample data to check it please

## Re: Nested If / And statement not working

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-13-2019 05:50 AM

I am afraid the growth rate is between 25 and 26. Depends on your coding logic, it will also show as 0 when your value is between 25 and 26. Please show the value with one decimal number and double check.

You can try modify the coding like below.

## Re: Nested If / And statement not working

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-14-2019 08:19 AM

I apologize to everybody for asking this stupid question. I should have sticked with that issues and sloved by myself.Actually, I lost patience.. After some hours, i found out the actual reason when i did it on Excel. The issues was that, i changed the format of that measures. and within if function i was using only integer number, i should have used decimal number.when i did it on excel it came into my mind..

Thanks to everyone, for your reply and your valueable time..and sorry once again for asking this stupid type question.

Thanks,

snandy

## Re: Nested If / And statement not working

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-14-2019 08:31 AM