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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
FatBlackCat30
Microsoft Employee
Microsoft Employee

multiple if statement

Hello all,

 

I have two columns: load and count.

I would like to create a new calculated column called "Class" with formula logic like this:

-if count > 1 then "Both" , load 

or if load = "Both" then "Both 

 

I am getting lost on how to use two differnet logical outcomes.

 

thanks for the help

 

1 ACCEPTED SOLUTION

@FatBlackCat30 

 

Create a custom column in query editor and use the below formula.

 

 

 

if [Count]>1 or [Load] = "Both" then "Both" else if  [Load] <> "Both" and [Count]<=1 then [Load] else null

 

 

image.png

Your 3rd point states "and the count is < 1" but the example show "count <= 1". So modify the above code as per your need.

 

If this helps, mark it as a solution

Kudos are nice too

 

 

 

Connect on LinkedIn

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Can explain with some data and example

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
VasTg
Memorable Member
Memorable Member

@FatBlackCat30 

 

I couldn't follow the if statement.

 

Could you provide a sample input and expected output?

 

 

Connect on LinkedIn

@VasTg 

1. if load says "Many" the outcome should be "Many"

2. but if the count is > 1 the outcome should be "both"

3. but if the load does not = "both" and the count is <1 then the outcome should be the load column

 

 

LoadCount LoadCountOutcome
Both1 Many1Many
Cat2 Cat2Both
Dog2 Dog2Both
Car1 Car1Car
Both2 Many2Many
Bottle2 Bottle2Both
Board1 Board1Board
Phone1 Phone1Phone
Tree1 Tree1Tree

@FatBlackCat30 

 

Create a custom column in query editor and use the below formula.

 

 

 

if [Count]>1 or [Load] = "Both" then "Both" else if  [Load] <> "Both" and [Count]<=1 then [Load] else null

 

 

image.png

Your 3rd point states "and the count is < 1" but the example show "count <= 1". So modify the above code as per your need.

 

If this helps, mark it as a solution

Kudos are nice too

 

 

 

Connect on LinkedIn
Anonymous
Not applicable

Here you go. Try this and let me know

Outcome = IF(OR('Table'[Load] = "Both", 'Table'[Count] > 1), "Both", 'Table'[Load])

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.