Forum Discussion
Count Projects that are between a certain percentage range
Hi all,
I created a measure that calculates the Percentage of completion (POC%) for a certain project in my table visual.
I would like to count how many project that are between a cretain percentage range as per below screenshot. I tried to add the POC% as a calculated column but did not work at all so need this workd based on the POC% measure that i have in my table.
Anyone knows how to manage?
7 Replies
- johnt75
Super User
You'll need to create 3 separate measures, one for each range, but the basic format could be something like
POC 0 - 40 = var summaryTable = ADDCOLUMNS( VALUES( 'Table'[Project]), "@poc", CALCULATE([POC])) return CALCULATE( COUNTROWS(summaryTable), [@poc} <= 40 )- AlexisOlson
Super User
Another option is to use a configuration table containing the ranges and follow the static segmentation pattern.
- jalaomar
Helper IV
Hi,
I am getting the following error, do you know why?
- johnt75
Super User
I think the DAX engine is confused because it can't tell whether [POC%] refers to the column or the measure. Rename the POC% column in the ADDCOLUMNS statement to use "@POC%" instead, and use that in the CALCULATE statement as well
- AlexisOlson
Super User
Wrapping CALCULATE around a variable won't change it at all.
Try filtering like this:
POC 0 - 40 = VAR summaryTable = ADDCOLUMNS ( VALUES ( 'Table'[Project] ), "@poc", [POC%] ) RETURN COUNTROWS ( FILTER ( summaryTable, [@poc] <= 40 ) )- jalaomar
Helper IV
Hi AlexisOlson This works perfectly!
Just a question, I have a table of all the projects, is it possible to filter based on the range of POC percentage? for example if I filter on POC% 0-40, then in the table I only see these projects