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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Aggregate a Calculated Measures

Hello everyone. I have created a measure that does exactly what I need it to do which is show an image based on the number. 

 

Availiability KPI* = SUMX(ResourceTimephasedDataSet, ResourceTimephasedDataSet[Availability])
Availiability KPI = 
var KPIText =
SWITCH(TRUE(),
ResourceTimephasedDataSet[Availiability KPI*] <= -101, "Way Overallocated",
ResourceTimephasedDataSet[Availiability KPI*] > -101 && ResourceTimephasedDataSet[Availiability KPI*] <= -50, "Overallocated",
ResourceTimephasedDataSet[Availiability KPI*] > -50 && ResourceTimephasedDataSet[Availiability KPI*] <= -20, "Partially Overallocated",
ResourceTimephasedDataSet[Availiability KPI*] > -20 && ResourceTimephasedDataSet[Availiability KPI*] <= 20, "OK",
ResourceTimephasedDataSet[Availiability KPI*] > 20 && ResourceTimephasedDataSet[Availiability KPI*] <= 50, "Improve",
ResourceTimephasedDataSet[Availiability KPI*] > 50 && ResourceTimephasedDataSet[Availiability KPI*] <= 100, "Plan",
ResourceTimephasedDataSet[Availiability KPI*] >= 101, "Missing Work",
"OK"
)

var KPIIcon =
SWITCH(TRUE(),
KPIText = "Way Overallocated", UNICHAR(127761),
KPIText = "Overallocated", UNICHAR(127765),
KPIText = "Partially Overallocated", UNICHAR(127763),
KPIText = "OK", UNICHAR(9989),
KPIText = "Improve", UNICHAR(11088),
KPIText = "Plan", UNICHAR(128221),
KPIText = "Missing Work", UNICHAR(9940)
)

var counticon = 
IF( [Availiability KPI*] <> BLANK(),
FORMAT( CALCULATE( DISTINCTCOUNT(ResourceTimephasedDataSet[Resource Name]), FILTER(ResourceTimephasedDataSet, ResourceTimephasedDataSet[Availiability KPI*] >= 1)), "#"),
BLANK())

return IF(HASONEVALUE(ResourceTimephasedDataSet[Resource Name]), KPIIcon, counticon)

 

Image1.png

 

What I want to show now is a count for each month, how many times the green check & etc.... shows up. 

  2022-032022-042022-05
 Way Overallocated011
 Overallocated000
 Partially Overallocated320
 Ok201
 Improve001
 Plan020
 Missing Work013

 

Any help would be greatly apprecaited, I've been trying to figure it out for the past 2 days.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I found my solution, took me 4 days to come up with this but I got it. I also had to do it for each case. I hope this will be able to help someone else in the future.

Availiable KPI Ok = COUNTX( DISTINCT(ResourceTimephasedDataSet[Resource ID]), IF(ResourceTimephasedDataSet[Availability KPI*] > -20 && ResourceTimephasedDataSet[Availability KPI*] <= 20, 1))

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

I found my solution, took me 4 days to come up with this but I got it. I also had to do it for each case. I hope this will be able to help someone else in the future.

Availiable KPI Ok = COUNTX( DISTINCT(ResourceTimephasedDataSet[Resource ID]), IF(ResourceTimephasedDataSet[Availability KPI*] > -20 && ResourceTimephasedDataSet[Availability KPI*] <= 20, 1))
Ashish_Mathur
Super User
Super User

Hi,

You do not need the SUMX.  A simple SUM function should do.

Availiability KPI* = SUM(ResourceTimephasedDataSet[Availability])

I think i canbring about some more improvements.  Please share the link from where i can download your PBI file.


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

Availability is also a a measure, do you think a simple sum will still work?

Ideally measures hould never be prceeded with the Table name.  That is why i suggested a SUM function.  If it is a measure, thena SUMX would be required.

Availiability KPI* = SUMX(ResourceTimephasedDataSet,[Availability])

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

I agree, for some reason my Power BI desktop on my computers started adding the table name. If you know how to turn it off, please let me know.

Tutu_in_YYC
Super User
Super User

You are trying to use description that doesnt exist as a table/column i.e Way Overallocated,Overallocated etc..

This means we need to create 1 measure for each of the description.

 

Way Overallocated = How many resource that is way overallocated
Overallocated = How many resource that is  overallocated
Partially overallocated = How many resource that is  partially overallocated
.....

 

and so on..

Then use these measures in a matrix and put the months in column, and its gonna look like this:

Tutu_in_YYC_1-1648604081409.png


Then turn on "show values as rows"

Tutu_in_YYC_2-1648604158110.png


And then it will look like this

 

Tutu_in_YYC_0-1648604025559.png

 

Anonymous
Not applicable

I'm also aware I will need multiple measures, I just can't get it to count each time is see a specific value.

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors