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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jaidee
Helper II
Helper II

Filter certain rows in colums to do calculation

I have an order table from where I would like to shor percentage of claim vs. all orders.

 

I have a claim colum and a colum for a complete sale (date).

 

Claim colum contains:

 

Null on the majority of orders

1 - Claim type 1

2 - Claim type 2

0 (error from db, so 0 i actually a normal order and should have null value.

 

 

When I do a diagram I want in each bar (per store) to show all orders (all blanks (null)) and status 0, as those are normal orders. Then I want to show how big a part status 1 and 2 are of the total orders. But as all sales are null, those with 0 is seen as a claim. If I filter 0 away then I see the actual claim, but I miss the rows with 0 on total amount of orders.

 

In Query Editor I cannot change 0 to Null

 

Any suggestions?

1 REPLY 1
kcantor
Community Champion
Community Champion

When using calculate be sure to filter to 0 as well as "" for the null values. Put your measures in seperately. Depending on how you want to create your measures You could start with a simple Count like:

Total Claim Type 2 = CALCULATE(COUNT(Fact[Claim]), Fact[Claim]=1) Which would give you a count of claims where the claim type is 1. You would need a count of all claims: Total All Claims = COUNT(Fact[Claim]).

Then use Divide with those two measures: % Type 1 = DIVIDE([Total Claim Type 2], [Total All Claims]). 

Of course, from your post, it is difficult to imagine the actual data formats. You may want to use SUM. I was making an assumption that claim referred to a claim type reference. If you have different fields, the calculations would be different. For example, if you have sales totals in a sales total column it might be something more along the lines of =CALCULATE(SUM(Fact[Sales]), Fact[Claim]=1) to calculate the total sales amount of sales lines with claim type of 1.

Can you post a bit of data to work with?





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

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors