Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Kimber
Helper III
Helper III

Divide function returns wrong result

I'm trying to get the percentage of students in the TAG program by grade level, which is also accurate when other slicers are applied. My calculated measure is returning the wrong results, even though the numerator and denominator values are correct when I split them out separately. 546/8892 should be .061, not .007. What could the issue be?
 Kimber_0-1714668791741.png

 

Here is my calculated measure: 

TAG % By Grade Level = 

DIVIDE(
    CALCULATE(
        DISTINCTCOUNTNOBLANK(PowerBIByTheNumbers_Current[Key_Student])
        ,KEEPFILTERS(PowerBIByTheNumbers_Current[TAG] = "TAG" 
            && PowerBIByTheNumbers_Current[Grade Level] = SELECTEDVALUE(PowerBIByTheNumbers_Current[Grade Level])
        )
    )
    , CALCULATE(
       DISTINCTCOUNTNOBLANK(PowerBIByTheNumbers_Current[Key_Student])
        ,REMOVEFILTERS(PowerBIByTheNumbers_Current[TAG])
    )
)

 

Here's the numerator, which is just the first half of the above measure. It produces the expected number.

TAG Numerator = 
 CALCULATE(
        DISTINCTCOUNTNOBLANK(PowerBIByTheNumbers_Current[Key_Student])
        ,KEEPFILTERS(PowerBIByTheNumbers_Current[TAG] = "TAG" 
            && PowerBIByTheNumbers_Current[Grade Level] = SELECTEDVALUE(PowerBIByTheNumbers_Current[Grade Level])
        )
    )

 

And here's the denominator, which also produces the expected number:

TAG Denominator = 
CALCULATE(
    DISTINCTCOUNTNOBLANK(PowerBIByTheNumbers_Current[Key_Student])
    ,REMOVEFILTERS(PowerBIByTheNumbers_Current[TAG])
)

  
Why doesn't dividing those 2 numbers produce the expected results?

1 REPLY 1
Anonymous
Not applicable

Hi  @Kimber ,

 

If the originally correct value (546, 8892) is displayed correctly in the other visual, but displays an incorrect value in the new visual, you can check if context switching is occurring correctly in the metrics, as the columns placed in each visual will be different, resulting in the dax potentially generating different values based on the data in the different columns.

Check to see if there are other slicers or filters applied to the visual that may affect the calculations.

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.