Forum Discussion

powerbiexpert22's avatar
powerbiexpert22
Impactful Individual
1 year ago
Solved

arithmetic operation error

if i use below measure in table visual then i am getting below error . i am usng direct query

if i remove distinctcount() from measure then it works fine and does not give any error . is there any alternative for implementing this measure to avoid this error?

 

measure = 

 

Total orders offline =
CALCULATE(DISTINCTCOUNT('ORDERS'[ORDER_NUMBER]),FILTER(PRODUCT,
PRODUCT[CategoryType]="Offline"))

 

 

  • powerbiexpert22 ,  Try using below 

     

    Total orders offline =
    SUMX(
        VALUES('ORDERS'[ORDER_NUMBER]),
        IF(
            CALCULATE(
                COUNTROWS(PRODUCT),
                PRODUCT[CategoryType] = "Offline"
            ) > 0,
            1,
            0
        )
    )

2 Replies

  • powerbiexpert22 ,  Try using below 

     

    Total orders offline =
    SUMX(
        VALUES('ORDERS'[ORDER_NUMBER]),
        IF(
            CALCULATE(
                COUNTROWS(PRODUCT),
                PRODUCT[CategoryType] = "Offline"
            ) > 0,
            1,
            0
        )
    )