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

IF and Else Conditional formatting

Hey Guys, 

 

I ran into another problem. I have Calculated colunm called Sunday Sug.Hr. Please see below picture and formular that I used to calculate' 

(Sunday Sug.Hr = 'Traffic by Month'[Sunday.] *RELATED('This Month'[Payroll Hours Based on GP]))

Besed on the result I want to show, 

if result = 0 then "0"

if result <8 then "8"

Else whatevether result 

 I tried several ways. its give me an error, (Ex IF AND, etc)

 

Column = SWITCH(('Traffic by Month'[Sunday.] * RELATED('This Month'[Payroll Hours Based on GP])) = 0,0,('Traffic by Month'[Sunday.] * RELATED('This Month'[Payroll Hours Based on GP])) < 8,8)

Thank you So much 

 

Dhana Capture.PNG

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @dananjayaprasad,

You just need to create a calculated column based on the column "Sunday Sug.Hr" using the formula below.

Column =
IF (
    'Traffic by Month'[Sunday Sug.Hr] = 0,
    0,
    IF (
        'Traffic by Month'[Sunday Sug.Hr] < 8,
        8,
        'Traffic by Month'[Sunday Sug.Hr]
    )
)


Best Regards,
Angelia

View solution in original post

3 REPLIES 3
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @dananjayaprasad,

You just need to create a calculated column based on the column "Sunday Sug.Hr" using the formula below.

Column =
IF (
    'Traffic by Month'[Sunday Sug.Hr] = 0,
    0,
    IF (
        'Traffic by Month'[Sunday Sug.Hr] < 8,
        8,
        'Traffic by Month'[Sunday Sug.Hr]
    )
)


Best Regards,
Angelia

Thank you Angelia. 

As an alternative for using those ugly nested IFs, the SWITCH function has some neat tricks - see https://powerpivotpro.com/2015/03/the-diabolical-genius-of-switch-true/

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.