cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Anonymous
Not applicable

## Get Insured Members with No Claims

Hello,

I am looking for some help writing a DAX formula to find the average weight of members who did not have any claims during the year.

My Table has the total amount of claims for each member by month, as follows:

 Month_Bracket MemberID Claimed Amount(\$) Weight_lbs 201905 xyz 1000.0 220 201905 ijw 45.12 170 201905 rtl 0 110 201906 rtl 0 110 201906 xyz 0 220 201912 eet 147.85 145

so in this contrived example, only member rtl had zero claims throughout 2019, so the average weight would be 110lbs.

Any idea how I would go about doing this in DAX?

I am able to write measures that filter the table, but I can't figure out how to operate on the filtered table.

1 ACCEPTED SOLUTION
Super User

Let's do it in two steps. First, calculate the total claims for each member. Then, filter and average.

``````AvgWeight =
VAR MemberSummary =
SUMMARIZE (
Table1,
Table1[MemberID],
"TotalClaimed", SUM ( Table1[Claimed Amount(\$)] ),
"Weight", AVERAGE ( Table1[Weight_lbs] )
)
RETURN
AVERAGEX ( FILTER ( MemberSummary, [TotalClaimed] = 0 ), [Weight] )``````

This assumes all the dates are in the same year.

2 REPLIES 2
Super User

Let's do it in two steps. First, calculate the total claims for each member. Then, filter and average.

``````AvgWeight =
VAR MemberSummary =
SUMMARIZE (
Table1,
Table1[MemberID],
"TotalClaimed", SUM ( Table1[Claimed Amount(\$)] ),
"Weight", AVERAGE ( Table1[Weight_lbs] )
)
RETURN
AVERAGEX ( FILTER ( MemberSummary, [TotalClaimed] = 0 ), [Weight] )``````

This assumes all the dates are in the same year.

Anonymous
Not applicable

Wow, this is elegant and simple!

I was trying to use SUMMARIZE but was missing the final step of filtering. Thank you so much.

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors