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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Missunderstandig about If statement

Hi fellows,

 

Im trying to make a if statement but there must be something wrong on my calculated column. Best way is show you what i am doing.

 

Importe Neto LY = CALCULATE(SUM('Ratios y Metricas'[Importe Neto]);FILTER('Detalles Fechas';'Detalles Fechas'[Año Fiscal]="FY 2018"))
 
Range = IF([Importe Neto LY] >= 0&&[Importe Neto LY] <= 500000;"0-500000";"Dif")
 
If wrong.jpg
 
As you can see isnt work fine, it seems pretty basic but I dont understand what am i doing wrong
 
can you somebody help me to do a if statement based over calculated column in order to get a net range based net sales??
 
Thanks in advanced
1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

Could you please try create the Importe Neto LY as a measure to use. Based on my test, it works fine on my side.

 

1.PNG

 

 

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

Could you please try create the Importe Neto LY as a measure to use. Based on my test, it works fine on my side.

 

1.PNG

 

 

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Indeed! works! 

 

Now, can I create a multiple if statements to achieve several conditions?

 

Range = var r = CALCULATE([Importe Neto LY]) return (IF(r >= 0&&r <= 500;"0-500";IF(r >= 501&&r <= 50000;"501-50000";"Dif")))

 

I want to create IF and Else to put some net sales range's.

 

Regards

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Works proper!!

 

Thanks a lot

Hi @Anonymous ,

 

We can  use the SWITCH function to archive your requirement:

 

Range =
VAR r =
    CALCULATE ( [Importe Neto LY] )
RETURN
    SWITCH (
        TRUE ();
        r >= 0
            && r <= 500; "0-500";
        r >= 501
            && r <= 50000; "501-50000";
        r >= 50001
            && r <= 500000; "50001-500000";
-- Add more condition here "Dif" )

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.