Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi Team,
I need to create a measure based on the client code. If the client code is A, then meausre=divide (sum(Table1[Charge] of A) , sum(Table2[Units] of A)). Can I please know how to achieve this requirement?
Thanks
DA
Solved! Go to Solution.
Your not giving a lot of context here, but should be something similiar to the following...
MyMeasure=
VAR chargeValue = SUMX(FILTER(ALLSELECTED(Table1),Table1[Charge] = "A"), FieldToBeSum)
VAR UnitValue = SUMX(FILTER(ALLSELECTED(Table2),Table2[Units] = "A"), FieldToBeSum)
RETURN DIVIDE(chargeValue ,UnitValue ,0)
Thanks @BrianConnelly Is there any other way to achieve this if the value of A is dynamic?
If you have a slicer to choose the dynamic value then add another variable...
MyMeasure=
VAR dynamicValue = SELECTEDVALUE(DyanmicFieldName, DefaultValue(e.g. "A"))
VAR chargeValue = SUMX(FILTER(ALLSELECTED(Table1),Table1[Charge] = dynamicValue ), FieldToBeSum)
VAR UnitValue = SUMX(FILTER(ALLSELECTED(Table2),Table2[Units] = dynamicValue ), FieldToBeSum)
RETURN DIVIDE(chargeValue ,UnitValue ,0)
Your not giving a lot of context here, but should be something similiar to the following...
MyMeasure=
VAR chargeValue = SUMX(FILTER(ALLSELECTED(Table1),Table1[Charge] = "A"), FieldToBeSum)
VAR UnitValue = SUMX(FILTER(ALLSELECTED(Table2),Table2[Units] = "A"), FieldToBeSum)
RETURN DIVIDE(chargeValue ,UnitValue ,0)