topic Using answer to a calculation within another calculation in Build Analytics
https://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2057#M314
<P>Im looking to use the answer from one calculation in another calculation on a separate widget with different filter set up. </P><P>This is my first calculation, it counts how many sales we have prior to drafting for each model and divides by the total number of sales. This then shows the percent sold prior to drafting for each of our models. </P><P>(count([UniqueJob]), [SoldPriorToDrafting], [Years in FinalSaleDate]) / (count([UniqueJob]), [Years in FinalSaleDate])</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CLewis_0-1643412425107.png" style="width: 400px;"><img src="https://community.sisense.com/t5/image/serverpage/image-id/1125iD2E2BF0B50218CF7/image-size/medium/is-moderation-mode/true?v=v2&px=400" role="button" title="CLewis_0-1643412425107.png" alt="CLewis_0-1643412425107.png" /></span></P><P> </P><P>The problem is I don't want the calculation to run first on the new widget I just need to use the number from the pivot table above as the other widget shows each individual job within the model. The calculation doesnt work when looking at it in this view. </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CLewis_1-1643413787436.png" style="width: 400px;"><img src="https://community.sisense.com/t5/image/serverpage/image-id/1126i3BA6BDC9EC6299CC/image-size/medium/is-moderation-mode/true?v=v2&px=400" role="button" title="CLewis_1-1643413787436.png" alt="CLewis_1-1643413787436.png" /></span></P><P> </P>Fri, 28 Jan 2022 23:52:06 GMTCLewis2022-01-28T23:52:06ZUsing answer to a calculation within another calculation
https://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2057#M314
<P>Im looking to use the answer from one calculation in another calculation on a separate widget with different filter set up. </P><P>This is my first calculation, it counts how many sales we have prior to drafting for each model and divides by the total number of sales. This then shows the percent sold prior to drafting for each of our models. </P><P>(count([UniqueJob]), [SoldPriorToDrafting], [Years in FinalSaleDate]) / (count([UniqueJob]), [Years in FinalSaleDate])</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CLewis_0-1643412425107.png" style="width: 400px;"><img src="https://community.sisense.com/t5/image/serverpage/image-id/1125iD2E2BF0B50218CF7/image-size/medium/is-moderation-mode/true?v=v2&px=400" role="button" title="CLewis_0-1643412425107.png" alt="CLewis_0-1643412425107.png" /></span></P><P> </P><P>The problem is I don't want the calculation to run first on the new widget I just need to use the number from the pivot table above as the other widget shows each individual job within the model. The calculation doesnt work when looking at it in this view. </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CLewis_1-1643413787436.png" style="width: 400px;"><img src="https://community.sisense.com/t5/image/serverpage/image-id/1126i3BA6BDC9EC6299CC/image-size/medium/is-moderation-mode/true?v=v2&px=400" role="button" title="CLewis_1-1643413787436.png" alt="CLewis_1-1643413787436.png" /></span></P><P> </P>Fri, 28 Jan 2022 23:52:06 GMThttps://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2057#M314CLewis2022-01-28T23:52:06ZRe: Using answer to a calculation within another calculation
https://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2059#M315
<P><LI-USER uid="257"></LI-USER> ,</P>
<P>If I'm understanding the problem correctly, you can use 'ALL' function which will ignore the filters/scope of a dimension. </P>
<P>Try this formula in second widget which will give you the same numbers as in first screenshot. </P>
<LI-CODE lang="javascript">(count([UniqueJob]), [SoldPriorToDrafting], [Years in FinalSaleDate], ALL(JobNo)) / (count([UniqueJob]), [Years in FinalSaleDate], ALL(JobNo))</LI-CODE>
<P> <span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="harikm007_0-1643656272876.png" style="width: 400px;"><img src="https://community.sisense.com/t5/image/serverpage/image-id/1127i61C602296F8FF79D/image-size/medium/is-moderation-mode/true?v=v2&px=400" role="button" title="harikm007_0-1643656272876.png" alt="harikm007_0-1643656272876.png" /></span></P>
<P>Is that what you are looking for?</P>
<P> </P>Mon, 31 Jan 2022 19:14:17 GMThttps://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2059#M315harikm0072022-01-31T19:14:17ZRe: Using answer to a calculation within another calculation
https://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2067#M317
<P>No this gives me the same result as I have without ALL added in. Its sounds like this should be an option but maybe its the placement off ALL at the end of my filters causing an issue? I am not sure. </P><P>It is still calculating on a row level so my job 9761 is counted as 1/1 instead of counting all accolade models sold prior to drafting which should be 9/ 13 total Accolade models sold</P><P> </P>Tue, 01 Feb 2022 21:11:39 GMThttps://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2067#M317CLewis2022-02-01T21:11:39ZRe: Using answer to a calculation within another calculation
https://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2203#M369
<P>Hi <LI-USER uid="257"></LI-USER> ,</P>
<P>I have faced a similar kind of use case to bring count and sum excluding a category in the pivot.</P>
<P>Below is the analysis:</P>
<P>For SUM its a straightforward with ALL function but for count, we need to check for all the filters we added in both the widgets, attaching a few screenshots for your reference.</P>
<P>this is the formula I used to get %percentage (([# of unique Brand ID],All([Gender]))/([# of unique Visit ID],All([Gender])))</P>
<P>In your case, you need to add JobID in All(JobID) both in numerator and denominator.</P>
<P>Hope this helps.</P>
<P>Ayantek. </P>Thu, 10 Feb 2022 16:04:11 GMThttps://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2203#M369Ayantek2022-02-10T16:04:11ZRe: Using answer to a calculation within another calculation
https://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2204#M370
<P>Thanks for the replies. We actually went a different route to come up with a solution and created a new column in SQL with the first calculation. </P>Thu, 10 Feb 2022 16:43:29 GMThttps://community.sisense.com/t5/build-analytics/using-answer-to-a-calculation-within-another-calculation/m-p/2204#M370CLewis2022-02-10T16:43:29Z