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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jeongkim
Post Prodigy
Post Prodigy

Multiple condition function in Dax

Hi guys,

 

Can anyone help me how to make new column using measure to lookup the Grade below. 

Type A, the bigger the Green is, and Type B is opposite. 

 

So how can I run IF or Switch function?

The function I tried seems wrong,,

 

jeongkim_2-1669622226871.png

 

jeongkim_0-1669622014519.png

 

jeongkim_1-1669622085471.png

 

Thanks in advance. 

Kim

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jeongkim ,

You can create a calculated column as below in the table 'SKT' to get it:

Icon Grade = 
SWITCH (
    TRUE (),
    'SKT'[Type] = 1
        && 'SKT'[Value] < 'SKT'[Red], 1,
    'SKT'[Type] = 1
        && 'SKT'[Value] > 'SKT'[Red]
        && 'SKT'[Value] <= 'SKT'[Light-Red], 2,
    'SKT'[Type] = 1
        && 'SKT'[Value] >= 'SKT'[Light-Green], 4,
    'SKT'[Type] = 1
        && 'SKT'[Value] >= 'SKT'[Green], 5,
    'SKT'[Type] = -1
        && 'SKT'[Value] >= 'SKT'[Red], 1,
    'SKT'[Type] = -1
        && 'SKT'[Value] < 'SKT'[Red]
        && 'SKT'[Value] >= 'SKT'[Light-Red], 2,
    'SKT'[Type] = -1
        && 'SKT'[Value] <= 'SKT'[Light-Green], 4,
    'SKT'[Type] = -1
        && 'SKT'[Value] <= 'SKT'[Green], 5,
    3
)

yingyinr_0-1669688178573.png

Best Regards

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @jeongkim ,

You can create a calculated column as below in the table 'SKT' to get it:

Icon Grade = 
SWITCH (
    TRUE (),
    'SKT'[Type] = 1
        && 'SKT'[Value] < 'SKT'[Red], 1,
    'SKT'[Type] = 1
        && 'SKT'[Value] > 'SKT'[Red]
        && 'SKT'[Value] <= 'SKT'[Light-Red], 2,
    'SKT'[Type] = 1
        && 'SKT'[Value] >= 'SKT'[Light-Green], 4,
    'SKT'[Type] = 1
        && 'SKT'[Value] >= 'SKT'[Green], 5,
    'SKT'[Type] = -1
        && 'SKT'[Value] >= 'SKT'[Red], 1,
    'SKT'[Type] = -1
        && 'SKT'[Value] < 'SKT'[Red]
        && 'SKT'[Value] >= 'SKT'[Light-Red], 2,
    'SKT'[Type] = -1
        && 'SKT'[Value] <= 'SKT'[Light-Green], 4,
    'SKT'[Type] = -1
        && 'SKT'[Value] <= 'SKT'[Green], 5,
    3
)

yingyinr_0-1669688178573.png

Best Regards

also how can I add another condition? if the Value is (blank) then just leave it blank without grading? 

 

Anonymous
Not applicable

Hi  @jeongkim ,

You can update the formula of calculated column as below to get it:

Icon Grade =
SWITCH (
    TRUE (),
    ISBLANK ( 'SKT'[Value] ), BLANK (),
    'SKT'[Type] = 1
        && 'SKT'[Value] < 'SKT'[Red], 1,
    'SKT'[Type] = 1
        && 'SKT'[Value] > 'SKT'[Red]
        && 'SKT'[Value] <= 'SKT'[Light-Red], 2,
    'SKT'[Type] = 1
        && 'SKT'[Value] >= 'SKT'[Light-Green], 4,
    'SKT'[Type] = 1
        && 'SKT'[Value] >= 'SKT'[Green], 5,
    'SKT'[Type] = -1
        && 'SKT'[Value] >= 'SKT'[Red], 1,
    'SKT'[Type] = -1
        && 'SKT'[Value] < 'SKT'[Red]
        && 'SKT'[Value] >= 'SKT'[Light-Red], 2,
    'SKT'[Type] = -1
        && 'SKT'[Value] <= 'SKT'[Light-Green], 4,
    'SKT'[Type] = -1
        && 'SKT'[Value] <= 'SKT'[Green], 5,
    3
)

Best Regards

Thank you so much! It is simpler and now working 🙂

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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