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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Charitha_RK
Frequent Visitor

Bad/incorrect measure totals

Hi Team,

 

I am trying to create a measure which gives a CPTV value(Measure [CPTV]= [ClaimCount]/[VehicleCount]*1000), but it is showing the incorrect total.

Slicers on page ModelYear, ProductLine and Claimclass
I tried using

CPTV = SUMX(VALUES(Warranty_Registration[CLAIMCLASS]),[CPTV]) which is working only when ClaimClass slicer is selected and not working properly for other slicers on page.
I could have disabled totoals if it was table or matrix, but the data i am showing is in line chart and if nothing is selected on
slicer, then the total value is shown wrong.
Please advise.

Charitha_RK_0-1698319842622.png

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Charitha_RK 

 

You can try the following methods.

CPTV = 
var ClaimCount = SUM(Warranty_Registration[CLAIMS_COUNT])
var VehicleCount = COUNT(Warranty_Registration[VEHICLES])
var res = CALCULATE(ClaimCount/VehicleCount*1000, ALLSELECTED(Warranty_Registration))
return res
CPTV NEW = Var _table=SUMMARIZE(Warranty_Registration,Warranty_Registration[CLAIMCLASSDESC],"SUM",[CPTV])
Return
IF(HASONEVALUE(Warranty_Registration[CLAIMCLASSDESC]),[CPTV],SUMX(_table,[SUM]))

vzhangti_0-1698832544881.png

Is this the result you expect? Please see the attached document.

Best Regards,

Community Support Team _Charlotte

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

 

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @Charitha_RK 

 

You can try the following methods.

CPTV = 
var ClaimCount = SUM(Warranty_Registration[CLAIMS_COUNT])
var VehicleCount = COUNT(Warranty_Registration[VEHICLES])
var res = CALCULATE(ClaimCount/VehicleCount*1000, ALLSELECTED(Warranty_Registration))
return res
CPTV NEW = Var _table=SUMMARIZE(Warranty_Registration,Warranty_Registration[CLAIMCLASSDESC],"SUM",[CPTV])
Return
IF(HASONEVALUE(Warranty_Registration[CLAIMCLASSDESC]),[CPTV],SUMX(_table,[SUM]))

vzhangti_0-1698832544881.png

Is this the result you expect? Please see the attached document.

Best Regards,

Community Support Team _Charlotte

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

 

devesh_gupta
Super User
Super User

@Charitha_RK Try to create a mesure like this and use calculate instead of sumx:

CPTV = CALCULATE([ClaimCount]/[VehicleCount]*1000, ALLSELECTED(Warranty_Registration))

The ALLSELECTED function removes any filters applied to the slicers and returns all the rows in the table. This should allow you to calculate the correct total value for your CPTV measure, even when other slicers are selected.

 

If you find this insightful, please provide a Kudo and accept this as a solution.

Hi Devesh, It is giving the same results.
Also [ClaimCount] is a measure = SUM(Warranty_Registration[CLAIMS_COUNT])
and [VehicleCount] = 
COUNT(Warranty_Registration[Vehicles])

Charitha_RK_0-1698394304154.png

I tried this as well, same results

var ClaimCount = SUM(Warranty_Registration[CLAIMS_COUNT])
var VehicleCount = COUNT(Warranty_Registration[VEHICLES])
var res = CALCULATE(ClaimCount/VehicleCount*1000, ALLSELECTED(Warranty_Registration))
return res

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.