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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

How to compare 2 columns with number

Hello guys,

 

I would like to ask you for help.

 

I have two columns A(last measurement) and B(previous measurement) with numbers 0-5. I need to compare numbers in column A with column B and make condition to add results to new columns C(trend).

3 Conditions:

- if number in column A is less then number in Column B then add number 1 to columns C

- if number in column A is equal to number in Column B then add number 2 to columns C

- if number in column A is bigger then number in Column B then add number 3 to columns C

 

Then I will use this new Column C and create conditional formating with 3 arrow icons for showing if last measurement is bigger, equal to or less then previous measurement.

 

Maybe my solution is wrong or too complicated.

Thank you for help

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello guys,

 

sorry for last reply, I solved this task with

column C =
if column A < column B, 1,
if column A = column B, 2,
if column A > column B, 3
)

Thank you all so much you tried help me.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hello guys,

 

sorry for last reply, I solved this task with

column C =
if column A < column B, 1,
if column A = column B, 2,
if column A > column B, 3
)

Thank you all so much you tried help me.

Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

You can use below code:-

column C =
SWITCH (
    TRUE (),
    column A < column B, 1,
    column A = column B, 2,
    column A > column B, 3
)

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

mh2587
Super User
Super User

You need a switch() function to give multiple condition 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.