Ravindra BagaleCourses & study guides

20. Dynamic Text and Dynamic Colour (Conditional Formatting)

20.8 KPI-based Colouring in Charts and Cards

Bar chart with red bars for slow stores:

Steps in Power BI

  1. Bar chart: Y-axis = Store Name, X-axis = Avg Delivery Time (mins). There must be no field in Legend (conditional colour is not available with a legend).
  2. Format visual › Visual › Bars › Colors › click fx next to Default color.
  3. Format style: Field value › [Delivery Time Colour] › OK. Stores slower than 15 minutes turn red.
  4. Analytics › Constant line at 15, labelled "15-min limit".

Other places for fx colours: card Callout value › Color (red Cancellation Rate above a threshold), General › Effects › Background (tint the whole card), Title font colour, line chart Markers, KPI visual colours, button fill, shape fill.

Cancellation Colour = IF([Cancellation Rate] > 0.05, "#D13438", "#107C10")   -- 5% is a practice threshold

Platform Colour = SWITCH(SELECTEDVALUE(Orders[Platform]), "Blinkit", "#F2C811", "Amazon Now", "#232F3E", "#8A8886")

Accessibility

Some viewers have colour-vision deficiency, so do not rely on red/green alone. Add icons, labels or patterns, and check the contrast of text on coloured backgrounds (Module 23).

Practice task

(1) Create a dynamic title for the Delivery page showing selected cities and platform. (2) Colour a store bar chart with the delivery colour measure. (3) Add data bars to Total Orders and traffic-light icons to Cancellation Rate in a table. (4) Build a narrative card with Total Orders, Avg Delivery Time and % Under 10 Mins.

Ravindra Bagale's Tip

Mitrano, khup students hard-code thresholds (udaharan mhanje 10 minutes) in several colour measures, then forget to change one of them. Put the target in a single measure or a small targets table, and reference it in every colour rule. Ha niyam lakshat theva.

Thodkyaat sangaycha tar (quick recap)

Fx button disla ki to measure ne control karta yeto; zero, ek aani anek selections sathi title test kara; aani colour chi direction (low is good) check kara. Aata pudhe jaauya dynamic charts kade.