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
Garbo62
Helper III
Helper III

How to Sum a Measure with an IF statement

Hi

I have a data set of Location where sometimes there is duplicate data for that location, it want to sum location if there are Utilised of Not utilised (ie count hpw may locations are utilised)

I written a measure to return if utilised or Not (1 or 0)

Utilised Activity Sum = ((IF(Sum(BI_SurveyData[RActivitiesUtilised])>1,1,0)))
Column 1 contains duplicate values and what i want to do is sum the above measue , colume 2
 
Garbo62_0-1723460562673.png

 

 
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from MFelix , please allow me to provide another insight: 
Hi  @Garbo62 ,

I created some data:

vyangliumsft_0-1723516313774.png

 

Here are the steps you can follow:

1. Create measure.

Test =
var _table1=
SUMMARIZE(
    ALL('BI_SurveyData1'),[Accordant Suvery No],[TimeStart],"Count",[Utilised Activity Sum])
return
COUNTX(
    FILTER(_table1,[Count]>0),[Accordant Suvery No])

2. Result:

vyangliumsft_1-1723516313778.png

 

If the results above don't meet your expectations, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from MFelix , please allow me to provide another insight: 
Hi  @Garbo62 ,

I created some data:

vyangliumsft_0-1723516313774.png

 

Here are the steps you can follow:

1. Create measure.

Test =
var _table1=
SUMMARIZE(
    ALL('BI_SurveyData1'),[Accordant Suvery No],[TimeStart],"Count",[Utilised Activity Sum])
return
COUNTX(
    FILTER(_table1,[Count]>0),[Accordant Suvery No])

2. Result:

vyangliumsft_1-1723516313778.png

 

If the results above don't meet your expectations, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

MFelix
Super User
Super User

Hi @Garbo62 ,

 

For this you need to use a SUMX function depending on the level of detail should be something similar to:

SUMX(VALUES(TABLE[Column]), [Utilised Activity Sum])

The Table Column should be replaced by the detail level you want to sum it


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.