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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.