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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
I would like to comibine the following two mesures (Average / SUM) based on county:
IF
data_merged[crashid]="LEA"
then
Solved! Go to Solution.
Hi @Anonymous ,
If you already have the two measure calculated you just need to do the following code:
IF (SELECTEDVALUE(data_merged[crashid])="LEA" , crashdeathcount_agg , crashdeathcount_agg )
If you don't have the measures separated you should do:3
Measure =
IF (
data_merged[crashid] = "LEA",
crashdeathcount_agg
= SUMX (
DISTINCT ( data_merged[crashid] ),
CALCULATE ( AVERAGE ( data_merged[crashdeathcount] ) )
),
crashdeathcount_agg
= SUMX (
DISTINCT ( data_merged[crashid] ),
CALCULATE ( SUM ( data_merged[crashdeathcount] ) )
)
)
Without any data and specif details on your data model is difficult to give you a better answer.
If this doesn't wqork can you share a sample data and expected result.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi,
Drag CrashID to the row labels of your Table visual and write this measure
=IF(HASONEVALUE(data_merged[crashid]),IF(VALUES(data_merged[crashid])="LEA",SUMX(DISTINCT(data_merged[crashid]),CALCULATE(AVERAGE(data_merged[crashdeathcount]))),SUMX(DISTINCT(data_merged[crashid]),CALCULATE(SUM(data_merged[crashdeathcount])))),BLANK())
Hope this helps.
Hi @Anonymous ,
If you already have the two measure calculated you just need to do the following code:
IF (SELECTEDVALUE(data_merged[crashid])="LEA" , crashdeathcount_agg , crashdeathcount_agg )
If you don't have the measures separated you should do:3
Measure =
IF (
data_merged[crashid] = "LEA",
crashdeathcount_agg
= SUMX (
DISTINCT ( data_merged[crashid] ),
CALCULATE ( AVERAGE ( data_merged[crashdeathcount] ) )
),
crashdeathcount_agg
= SUMX (
DISTINCT ( data_merged[crashid] ),
CALCULATE ( SUM ( data_merged[crashdeathcount] ) )
)
)
Without any data and specif details on your data model is difficult to give you a better answer.
If this doesn't wqork can you share a sample data and expected result.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCheck out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!