Decimal amount not displaying in log Analytics query

%3CLINGO-SUB%20id%3D%22lingo-sub-167609%22%20slang%3D%22en-US%22%3EDecimal%20amount%20not%20displaying%20in%20log%20Analytics%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-167609%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20I%20have%20a%20really%20simple%20query%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EApplicationInsights%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20TelemetryType%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22Availability%22%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%20%3CSPAN%3Ecount%3C%2FSPAN%3E%3CSPAN%3E()%20%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%20AvailabilityResult%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%20failedCount%3Dsumif(count_%2C%20AvailabilityResult%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22Fail%22%3C%2FSPAN%3E%3CSPAN%3E)%2C%20totalCount%3Dsum(count_)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20(failedCount%20%2F%20totalCount)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Ebut%20the%20%22extend%26nbsp%3B(failedCount%20%2F%20totalCount)%22%20is%20just%20displaying%20as%20a%200%2C%20its%20a%20really%20small%20decimal%20.003...how%20do%20I%20display%20this%20as%20a%20decimal%20value%3F%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-167609%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApplication%20Insights%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-167883%22%20slang%3D%22en-US%22%3ERe%3A%20Decimal%20amount%20not%20displaying%20in%20log%20Analytics%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-167883%22%20slang%3D%22en-US%22%3E%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%20%3CSPAN%3Ecount%3C%2FSPAN%3E%3CSPAN%3E()%20%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%20AvailabilityResult%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%20failedCount%3Dsumif(count_%2C%3CSTRONG%3E%20AvailabilityResult%20%3D%3D%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSTRONG%3E%22Fail%22)%2B0.00000%3C%2FSTRONG%3E%3CSPAN%3E%2C%20%3CSTRONG%3EtotalCount%3Dsum(count_)%2B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSTRONG%3E0.00000%3C%2FSTRONG%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20avail%3D%3C%2FSPAN%3E%3CSPAN%3E100%3C%2FSPAN%3E%3CSPAN%3E%20-%20((failedCount%20%2F%20totalCount)*%3C%2FSPAN%3E%3CSPAN%3E100%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Eadding%20by%20this%20decimal%20forces%20a%20cast%20to%20decimal.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-167683%22%20slang%3D%22en-US%22%3ERe%3A%20Decimal%20amount%20not%20displaying%20in%20log%20Analytics%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-167683%22%20slang%3D%22en-US%22%3E%3CP%3ETwo%20valid%20options%3A%3C%2FP%3E%0A%3CP%3E1)%20explicit%20type%20casting%20to%20floating%20point%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E...%20%7C%20extend%20failureRate%20%3D%20todouble(failedCount)%20%2F%20todouble(totalCount)%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%3E2)%20implicit%20type%20casting%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%3E...%20%7C%20extend%20failureRate%20%3D%20failedCount%20*%201.0%20%2F%20totalCount%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Highlighted
Deleted
Not applicable

Hi I have a really simple query

 
ApplicationInsights
| where TelemetryType == "Availability"
|summarize count() by AvailabilityResult
|summarize failedCount=sumif(count_, AvailabilityResult == "Fail"), totalCount=sum(count_)
|extend (failedCount / totalCount)
 
but the "extend (failedCount / totalCount)" is just displaying as a 0, its a really small decimal .003...how do I display this as a decimal value?
 
2 Replies
Highlighted

Two valid options:

1) explicit type casting to floating point:

 

... | extend failureRate = todouble(failedCount) / todouble(totalCount)

2) implicit type casting:

... | extend failureRate = failedCount * 1.0 / totalCount
Highlighted
|summarize count() by AvailabilityResult
|summarize failedCount=sumif(count_, AvailabilityResult == "Fail")+0.00000, totalCount=sum(count_)+0.00000
|extend avail=100 - ((failedCount / totalCount)*100)
 
adding by this decimal forces a cast to decimal.