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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Sriram_K
Helper I
Helper I

If statement is not working in for decimal numbers

Hi,

 

If statement is not working for decimal numbers.
Example:

Excepted PriceActual Price
100.25101.45
35.7624.54
45.6525.43
 0.00
95.45100.25
 0.00


I want to create a colume as validation status colume.by using Switch statement geeting same result.
Switch satement 

SWITCH (
TRUE (),
[Actual Price]>[Expected Price],"Needs Review",
[Actual Price]<=[Expected Price],"Validated",
[Actual Price]=0,"Not Charged")

Please help me 
1 ACCEPTED SOLUTION
FrankAT
Community Champion
Community Champion

Hi @Sriram_K 

take care about the order in SWITCH() function:

 

28-08-_2020_18-02-48.png

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@Sriram_K , the should have work. Just check the data type

You are creating a new column and [Actual Price], [Expected Price] are columns

Switch satement
SWITCH (
TRUE (),
[Actual Price]>[Expected Price],"Needs Review",
[Actual Price]<=[Expected Price],"Validated",
[Actual Price]=0,"Not Charged")

FrankAT
Community Champion
Community Champion

Hi @Sriram_K 

take care about the order in SWITCH() function:

 

28-08-_2020_18-02-48.png

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Hi,

 

When i creted this as a measure it's working but when i create it as a column getting incorrect result.
i want to use result column(Validation) as a slicer.
Can any once help me to Change this measure as working column.

Thanks,

Sriram.K 

Pragati11
Super User
Super User

hi @Sriram_K ,

 

Can you please add detail on the expected output?

You haven't mentioned what you are currently getting problem with decimal numbers.

Please add detail this is not helping me much.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi,

 

Excepted PriceActual PriceExpected OutputGetting from Switch statement 
100.25101.45Needs reviewValidated
35.7624.54Validated Validated
45.6525.43Validated Validated
 0.00Not ChargedValidated
95.45100.25Needs reviewValidated
 0.00Not ChargedValidated


Data type is rounded value as 2 decimal.

FrankAT
Community Champion
Community Champion

Hi @Sriram_K 

if you need it as a measure try the following solution:

 

28-08-_2020_18-22-24.png

 

 

Validation Measure = 
SWITCH(TRUE(),
    MIN('Table'[Actual Price]) > MIN('Table'[Excepted Price]), "Needs Review",
    MIN('Table'[Actual Price]) = 0, "Not Changed",
    MIN('Table'[Actual Price]) <= MIN('Table'[Excepted Price]), "Validated"
)

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

 

 

vanessafvg
Super User
Super User

what are your data types set as? what error are you getting?




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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