9 Replies Latest reply on Feb 14, 2018 6:19 AM by Christian R. Houen

# Using LoDs to calculate percentage of binary outcome

Hi

I'm relatively new to using LoD, but I want to use them in this table, so instead of having two rows per BufferID, I would have one showing the percentage of total.

• ###### 1. Re: Using LoDs to calculate percentage of binary outcome

You do not need LOD for that. You can just do by table calculations

If you do not want the 0,1 in the view, remove the dimension from the view and click on the measure to add a table calculation

Choose 'Percent of total' and edit the calculation to set if you want it by table down/across

3 of 3 people found this helpful
• ###### 2. Re: Using LoDs to calculate percentage of binary outcome

For learning purposes, I would like to use LOD.

I have found by using the formula

{FIXED [BufferID],[Ordredato]: SUM([Shippet til tiden?])}

I get the number for each '1' in previous graph.

Now the challenge is to get this as percentage of total.

1 of 1 people found this helpful
• ###### 3. Re: Using LoDs to calculate percentage of binary outcome

I still need help with this issue

1 of 1 people found this helpful
• ###### 4. Re: Using LoDs to calculate percentage of binary outcome

1 of 1 people found this helpful
• ###### 5. Re: Using LoDs to calculate percentage of binary outcome

You can create table calculation on your measures.

Then edit it to set on what level you want.

1 of 1 people found this helpful
• ###### 6. Re: Using LoDs to calculate percentage of binary outcome

But that is not what I want. As you see on my initial post there is 0 and 1 within each buffer. I want 1/(1+0) as percentage.

Take buffer 1, 'Ordredato' 22. There are 319 0's and 826 1's. I want the percentage of 826/(319+826) in that cell.

1 of 1 people found this helpful
• ###### 7. Re: Using LoDs to calculate percentage of binary outcome

Buffer ID 3 has no 0's, which is why it only shows the number of 1's.

1 of 1 people found this helpful
• ###### 8. Re: Using LoDs to calculate percentage of binary outcome

Your LOD is giving you the correct value using sum because only 1's are summed up

0 is not adding to the LOD

You need another LOD to get a total of both 1's and 0's

you can do that by writing an if condition inside the sum

{ fixed [BufferID],[Ordredato]: sum(if isnull([Shippet til tiden?]) then 0 else 1 end )}

or

{ fixed [BufferID],[Ordredato]: sum(if [Shippet til tiden?]=1 or

[Shippet til tiden?]=0  then 0 else 1 end )}

then have a calculated field to get your %

sum([LoD BufferID til tiden])/sum([LoD BufferID til tiden_Total])

2 of 2 people found this helpful
• ###### 9. Re: Using LoDs to calculate percentage of binary outcome

You're a hero!

1 of 1 people found this helpful