Forum Discussion

simonrtaylor's avatar
simonrtaylor
Frequent Visitor
7 years ago
Solved

Return % based on COUNTIF

Hi, I've haven't found this exact question asked elsewhere and hope you can help.   I have two columns and want to produce the equivalent of a COUNTIF formatted as a percentage:   Target  Date - ...
  • Anonymous's avatar
    Anonymous
    7 years ago
    -- You should have a proper Date table
    -- linked to T[Target Date] and slice
    -- by its attributes. T[Target Date]
    -- should be a hidden column in T.
    
    [Measure] =
    var __inside =
    	CALCULATE(
    		COUNTROWS( T ),
    		KEEPFILTERS( T[KPI] = "inside" )
    	)
    var __totalRowcount =
    	COUNTROWS( T )
    var __ratio =
    	DIVIDE( __inside, __totalRowCount )
    return
    	__ratio

    Please do not multiply the output by 100. Instead, format the number as Percentage.

     

    Best

    Darek