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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Thiagops
Helper II
Helper II

Problem with division

Good Morning,
Guys I'm trying to do a division, but the result is not correct. Can anyone help me?

 

% de conversão em vendas = DIVIDE(([Total de pedidos faturados]),([Total de cotações digitadas]))
 
Total de cotações digitadas = COUNT(PEDIDO_VENDA[NS_CODIGO])
Total de pedidos faturados = COUNT(NF_SAIDA[NS_CODIGO])
Thiagops_0-1674129744342.png

The result should be 83.84% and not 84.48%

 

1 ACCEPTED SOLUTION
jaweher899
Impactful Individual
Impactful Individual

One possible issue could be that the COUNT function is counting duplicate values in either the PEDIDO_VENDA or NF_SAIDA table. To fix this, you can try using the DISTINCTCOUNT function instead of COUNT. This will only count unique values in the table.

Another possible issue could be that the PEDIDO_VENDA and NF_SAIDA tables have different filters applied, resulting in a different count for each table. To fix this, you can try applying the same filters to both tables before performing the division.

Lastly, you can check for any hidden filters that may be affecting the data.

Try the following:

% de conversão em vendas = DIVIDE(DISTINCTCOUNT(NF_SAIDA[NS_CODIGO]), DISTINCTCOUNT(PEDIDO_VENDA[NS_CODIGO]))

If the above still does not work, please provide more details about your data and the filters applied to the tables.

View solution in original post

3 REPLIES 3
Thiagops
Helper II
Helper II

I managed to solve it here. The filters were different. Thank you very much

jaweher899
Impactful Individual
Impactful Individual

One possible issue could be that the COUNT function is counting duplicate values in either the PEDIDO_VENDA or NF_SAIDA table. To fix this, you can try using the DISTINCTCOUNT function instead of COUNT. This will only count unique values in the table.

Another possible issue could be that the PEDIDO_VENDA and NF_SAIDA tables have different filters applied, resulting in a different count for each table. To fix this, you can try applying the same filters to both tables before performing the division.

Lastly, you can check for any hidden filters that may be affecting the data.

Try the following:

% de conversão em vendas = DIVIDE(DISTINCTCOUNT(NF_SAIDA[NS_CODIGO]), DISTINCTCOUNT(PEDIDO_VENDA[NS_CODIGO]))

If the above still does not work, please provide more details about your data and the filters applied to the tables.

FreemanZ
Super User
Super User

hi @Thiagops

It seems your tables are related, try like:

% de conversão em vendas =
DIVIDE(
    (CALCULATE ( [Total de pedidos faturados], ALL(PEDIDO_VENDA)),
    (CALCULATE ( [Total de cotações digitadas], ALL(NF_SAIDA))
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.