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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
barlevitzky
Helper I
Helper I

Calculate function return incorrect result

Hi all,

I have the following table:

0                    1             3             

236807   65978         58434   

 

I want to calculate the proportion of the result of "1" column to "0" column.

Table name = Data

Column name = Pixel ID1

Values = Pixel Fired

 

I created the following measure:

"1" / "0" = DIVIDE(CALCULATE(sum(Data[Pixel Fired]),(Data[Pixel ID1]=1)),CALCULATE(sum(Data[Pixel Fired]),Data[Pixel ID1]=0))

The result that I get is 25.26%. 

But if I calculate manually  65978/236807 = 27.8%

 

What am I missing? 

even if I am adding rows to the table, the calculation for each row is close but incorrect. 

 

Thanks,

 

 

 

 

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @barlevitzky,

 

 With the data you provide, I’ve tried again and it worked in my site. It seems that your measure "1" / "0"  is right.

 

Here is my test pbix file, you could take a look at it to see if there is any difference.

 

If you still can' t get the correct result, could you share a dummy pbix file which can reproduce the issue, so that we can help further investigate on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
Community Champion

Not sure, but I'm not seeing it.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlDSUTIyNrMwMFeK1YlWMgRyzUwtzS3APGMgz9TCxNhEKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Pixel ID1" = _t, #"Pixel Fired" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Pixel ID1", Int64.Type}, {"Pixel Fired", Int64.Type}})
in
    #"Changed Type"

pixel.png

 

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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