cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jaidee Regular Visitor
Regular Visitor

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
Highlighted
Super User
Super User

Re: Filter certain rows in colums to do calculation

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 Datanaut!