Forum Discussion

Oaabwen42's avatar
Oaabwen42
Frequent Visitor
1 year ago
Solved

Power BI Doing Division Incorrectly

Hi everyone,

 

I'm trying to make a very simple "average number of support tickets per month" calculation. I have the following:

 
Avg Tickets Per Month =
DIVIDE(
    COUNTROWS(Table),
    DISTINCTCOUNT(Table[YearMonth]), 0)
 
However, the number it returned, 4.33, didn't seem right. I split the COUNTROWS and DISTINCTCOUNT functions into their own measures to test:
 
Tickets = COUNTROWS(Table)
Months = DISTINCTCOUNT(Table[YearMonth])
 
Tickets returned 52, and Months returned 9. So Avg Tickets Per Month should be 52 / 9 = 5.77
 
I also tried the following and got 4.33 again:
 
Avg Tickets Per Month = DIVIDE([Tickets], [Months], 0)
 
What is going on??? I don't see why it would return the wrong number
  • Oaabwen42 , Make sure there is no visual level filter on that card

    Try this measure for count distinct

    countrows(values(Table[YearMonth]))

3 Replies

    • Oaabwen42's avatar
      Oaabwen42
      Frequent Visitor

      Hi,

      I'm using a card visual. I can't share the sample pbix or data, but you can see what's happening in this screenshot: 

      Tickets = 52, Months = 9, therefore DIVIDE(52, 9, 0) = 5.77, but it returns the wrong number.

      • amitchandak's avatar
        amitchandak
        Super User

        Oaabwen42 , Make sure there is no visual level filter on that card

        Try this measure for count distinct

        countrows(values(Table[YearMonth]))