Forum Discussion

Andrew_na_lang's avatar
4 years ago
Solved

Count and percentage

Hi Power bi Family,

I am stuck here. I have done this in the past but not sure why it wasn't working now. 

I basically need to have a count of the customers who have "BLANK" CountOfOrdersAfterClaim and with values. 


on the table visual above,

I have 12 rows, 4 of which have blank values and 8 have values. 

How should I do it? 

  • bcdobbs's avatar
    bcdobbs
    4 years ago

    Try something like the following:

     

    NumberBlank = 
    
    VAR CustomersWithBlanks = 
    	FILTER (
    		VALUES( CustomerTable[CustomerName] ),
    		ISBLANK([CountOfOrderAfterClaim])
    		)
    		
    RETURN COUNTROWS( CustomersWithBlanks )

     

    I suspect you can do something more efficient by testing directly but would need to see your data model.

     

5 Replies

  • bcdobbs's avatar
    bcdobbs
    Icon for Community Champion rankCommunity Champion

    Is CountOfOrdersAfterClaim a calculated column or measure?

    • Andrew_na_lang's avatar
      Andrew_na_lang
      Icon for Helper V rankHelper V

      bcdobbs It is a measure. 

      CountOfOrderAfterClaim = CALCULATE(COUNTROWS(Orders), FILTER(Orders, Orders[Count_of_orders_after_Last_claim]= "1" && Orders[order_status_description] = "Order Completed" ))
      • bcdobbs's avatar
        bcdobbs
        Icon for Community Champion rankCommunity Champion

        Ok and that that visual... what are you grouping by? Eg is it one line per customer? Do you have a customer dimension table with customer Ids?