Forum Discussion

sdavis's avatar
sdavis
Frequent Visitor
8 years ago
Solved

Divide with a filtered measure

Hi, 

 

I am new to PowerBI and trying to a measured columns in PowerBI for displaying a Card. I'm trying to divide with a filter, but getting an error (screenshot below). How can I devide with a filtered measure? I created a formula beforehand for the First response (hrs) column.

 

I tried referencing this link: Divide with a filter

 

Formula:
Tickets responded = Count of tickets responded under 25 hrs/Count of tickets

 

Data:

 

Ticket IDCreated timeInitial response time
12342018-04-15 06:14:102018-04-16 08:44:45
12352018-04-16 00:09:10 
12362018-04-16 02:41:51 
12372018-04-16 02:45:14 
12382018-04-16 07:24:582018-04-16 07:55:06
12392018-04-16 10:37:072018-04-16 12:22:33
12402018-04-16 11:21:122018-04-16 15:41:24
12412018-04-16 11:28:372018-04-16 15:41:40
12422018-04-16 12:04:47 
12432018-04-16 13:14:372018-04-17 10:43:21

 

1st formula: First response (hrs) = DATEDIFF('Sheet1 (2)'[Created time], 'Sheet1 (2)'[Initial response time], HOUR)

 

2nd formula: (not working)
Tickets Responded = DIVIDE(CALCULATE(COUNT('Sheet1 (2)'[Ticket ID], 'Sheet1 (2)'[First response (hrs)] < 25)),COUNT('Sheet1 (2)'[Ticket ID]))

 

  • Hi,

     

    Does this work?

     

    =DIVIDE(CALCULATE(COUNT('Sheet1 (2)'[Ticket ID]),FILTER(Sheet1 (2), 'Sheet1 (2)'[First response (hrs)] < 25)),COUNT('Sheet1 (2)'[Ticket ID]))

14 Replies

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

    The error that you are getting, you need to end your first COUNT function with a ) just before your ",". 

    • sdavis's avatar
      sdavis
      Frequent Visitor

      Thank you Greg_Deckler

       

      That fixed the formula error, but it didn't show the result I expected. When showing the result in a card, it showed 1. I was trying for the result to be 4. 

       

      Am I using the right formula for trying to divide tickets under 25hrs by the total?

  • Hi,

     

    How can tht division yield the result as 6?  The number of records with a response time as < 25 hours is 4.  4/10 should be 40%.

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

         

        Does this work?

         

        =DIVIDE(CALCULATE(COUNT('Sheet1 (2)'[Ticket ID]),FILTER(Sheet1 (2), 'Sheet1 (2)'[First response (hrs)] < 25)),COUNT('Sheet1 (2)'[Ticket ID]))