cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Conditional Formatting based on specific value for each row

Hi i need help to make conditional formatting but each row depends on different value.
at 'On Hand qty', the background color depends on the 'Target quantity' such as:

on the fifth row, 'target quantity' is 3,
so if 'on hand qty' >= 3 is green, and 3 < is red

but,
on the seventh row, 'target quantity' is 13,
so if 'on hand qty' >= 13 is green, and 13 < is red

1 ACCEPTED SOLUTION
Community Champion

``````measure 3=
IF (
SUM ( INF[On Hand Qty] ) >= INT ( MAX ( INF[Target Quantity] ) ),
"Green",
"Red"
)``````

Output:-

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

10 REPLIES 10
Community Champion

Hi @muhaiza ,

If on hand qty and target quantity are measure then try this:-

``measure 3 = if( [OnHand Qunatity] >= [target quantity] , "Green","Red")``

or if those are column then use below code:-

``measure 3 = if( sum(table[OnHand Qunatity]) >= sum(table[target quantity]) , "Green","Red")``

Now add this measure like below for conditional formatting:-

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.

Frequent Visitor

Hi @Samarth_18 ,

why it says the value cannot be determined? i'am very sure the spelling of my column is all true

Community Champion

``measure 3 = if( sum(table[OnHand Qunatity]) >= sum(table[target quantity]) , "Green","Red")``

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Frequent Visitor

okay, now the coding seems working, but why i can't click on the measure 3?😢

Community Champion

@muhaiza Is it possible for you to share your PBIX file after removing sensitive data?

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Frequent Visitor
Community Champion

``````measure 3=
IF (
SUM ( INF[On Hand Qty] ) >= INT ( MAX ( INF[Target Quantity] ) ),
"Green",
"Red"
)``````

Output:-

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Frequent Visitor

@Samarth_18 Thank youuu so much!!

Super User

@muhaiza , Create a new color measure

Switch( True() ,

[target quantity] = 3 && [OnHand Qunatity] >=3 , "Green",

[target quantity] = 3 && [OnHand Qunatity] < 3  , "Red",

[target quantity] = 13 && [OnHand Qunatity] >=13 , "Green",

[target quantity] = 13 && [OnHand Qunatity] <13 , "Red"

)

Change the value as per need.  Use in conditional formatting using field value option

How to do conditional formatting by measure and apply it on pie? : https://youtu.be/RqBb5eBf_I4

Frequent Visitor

Hi @amitchandak , Thank you!
Sorry, i'm still new to this but why it says 'cannot find name'?
do i need to declare something first?

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors