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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
mdrammeh
Helper III
Helper III

How to Create Measure for Multiple Criteria in Power Query

Hello,

 

I need help creating the following measures in Power Query and Power BI separately:

 

Measure

  • If the “Cost variance” is less than or equal to -$10,000 and is -10% or Greater, return “Under Budget”; Also return “Under Budget” when the % Change is less than or equal -10%
  • If the “Cost variance” is Greater than or equal to $10, 001, and is 10% or greater, return “Over Budget”
  • If the “Cost variance” is between $9,999 and $10,000, return “On Target”
  • Otherwise, return blank
 Investment $Budget DollarsCost Variance% ChangeMeasure
$34,500,352$20,176,565$14,323,78742% 
$65,000$3,949,110($3,884,110)-5976% 
$34,565,352$24,125,675$10,439,67730% 

See attached picture with data sample

7 REPLIES 7
Sean
Community Champion
Community Champion

@mdrammeh

 

Column = 
SWITCH (
    TRUE (),
    'Table'[Cost Variance] <= -10000 && 'Table'[% Change] <= -.1, "Under Budget",
    'Table'[Cost Variance] >= 10001 && 'Table'[% Change] >= .1, "Over Budget",
    'Table'[Cost Variance] >= 9999 && 'Table'[Cost Variance] <=1000, "On Target",
    BLANK ()
)

Measure = 
SWITCH (
    TRUE (),
    MIN ( 'Table'[Cost Variance] ) <= -10000 && MIN ( 'Table'[% Change] ) <= -.1, "Under Budget",
    MIN ( 'Table'[Cost Variance] ) >= 10001 && MIN ( 'Table'[% Change] ) >= .1, "Over Budget",
    MIN ( 'Table'[Cost Variance] ) >= 9999 && MIN ( 'Table'[Cost Variance] ) <=1000, "On Target",
    BLANK ()
)

Hope this helps.

Good Luck! Smiley Happy

Thanks for the quick response. I just want to make sure am doing this correctly because it's showing an error message

 

Power Query Measure.PNG

Sean
Community Champion
Community Champion

The above was DAX

In the Query Editor the formula would be...

 

= if [Cost Variance] <= -10000 and [#"% Change"] <= -.1 then "Under Budget"

else if [Cost Variance] >= 10001 and [#"% Change"] >= .1 then "Over Budget"

else if [Cost Variance] >= 9999 and [Cost Variance] <= 10000 then "On Target"

else null

 

QE - Custom Column.png

 

It worked everywhere except where the % Change field = "null". How can I correct this error?Column returned Error.PNG

You have to filter out the null values.

I'm not sure it's related to your error, but shouldn't the On Target statement cover the range from minus9999 to 10,000?

 

Datatouille
Solution Sage
Solution Sage

Hi @mdrammeh

 

Just to make sure I understand well your requirement. Do you want to create a measure or a calculated column ?

 

See here the difference and which option better fits your requirement: http://exceleratorbi.com.au/calculated-columns-vs-measures-dax/

 

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors