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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
maleehahk
Regular Visitor

i need to create a dax measure to create a percentage and colour banding

I need to create a measure which calculates percentage of units completed into the following categories:

Gold >95%, Green 80 -95%, Amber 65-79%, Red <65%

 

currently the units completed are whole numbers 

 

how can i create colour groups as well 

 

this will act as a KPI to show which colour group each person is in based on the number of units completed 

 

 

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

i cant share the data but i need a dax measure to show different band groups catergorised by colours based on % values. 

 

For example i have units due and units completed and units submitted.

 

i need to create 4 bands to show how many units completed out of due. 

 

Gold >95%, Green 80 -95%, Amber 65-79%, Red <65%

 

therefore, if there are 50 units out 50 it should be gold

and 50 out of 60 should be green 

 

maleehahk
Regular Visitor

@123abc hi thank you for replying.

 

i have used your dax measure for colour banding however it is showing them all as Red even if its 100%

123abc
Community Champion
Community Champion

Create a DAX measure to calculate the percentage of units completed:

Completion Percentage = DIVIDE(SUM(YourTable[Units Completed]), COUNTROWS(YourTable), 0)

 

This measure uses the DIVIDE function to calculate the percentage of units completed. It sums up the "Units Completed" column and divides it by the total number of rows in the table.

  1. Create a DAX measure to determine the color band:

Color Band =
SWITCH(TRUE(),
[Completion Percentage] > 95, "Gold",
[Completion Percentage] >= 80, "Green",
[Completion Percentage] >= 65, "Amber",
"Red"
)

 

This measure uses the SWITCH function to assign a color band based on the percentage calculated in the previous step. It checks the value of the "Completion Percentage" measure against your specified thresholds and assigns the appropriate color.

Now, when you use these measures in your visualizations, you'll see the "Completion Percentage" and "Color Band" for each person, and the "Color Band" will categorize them into Gold, Green, Amber, or Red based on the completion percentage.

Make sure to replace "YourTable" with the actual name of your table and "Units Completed" with the actual name of your column containing the units completed data in your Power BI dataset.

 

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

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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